ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
esp_log.h
Go to the documentation of this file.
1
44
45#pragma once
46
47#include <stdint.h>
48
49/* The enumerator spellings below are fixed by ESP-IDF: the vendored core
50 passes them to esp_log_level_set() and compares against them, so they
51 cannot take this project's k_ prefix. clang-tidy's naming rule is
52 suppressed across the block, following the ThreadX shim precedent in
53 libs/ra8_wdt_supervisor. */
54/* NOLINTBEGIN(readability-identifier-naming) -- ESP-IDF-fixed spellings. */
55
89
90/* NOLINTEND(readability-identifier-naming) */
91
92#ifndef LOG_LOCAL_LEVEL
114#define LOG_LOCAL_LEVEL ESP_LOG_INFO
115#endif /* LOG_LOCAL_LEVEL */
116
158[[gnu::format(printf, 3, 4)]] void
159ra8_esp_hosted_log_write(int level, const char* tag, const char* fmt, ...);
160
196void ra8_esp_hosted_log_hexdump(int level, const char* tag, const void* buf, uint32_t len);
197
233void ra8_esp_hosted_log_level_set(const char* tag, int level);
234
270[[noreturn]] void ra8_esp_hosted_log_fatal(const char* tag, const char* expr, int code);
271
291#define ESP_LOG_LEVEL_LOCAL(level, tag, ...) \
292 do { \
293 if ((int)(level) <= (int)LOG_LOCAL_LEVEL) { \
294 ra8_esp_hosted_log_write((int)(level), (tag), __VA_ARGS__); \
295 } \
296 } while (0)
297
313#define ESP_LOGE(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, (tag), __VA_ARGS__)
314
329#define ESP_LOGW(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, (tag), __VA_ARGS__)
330
346#define ESP_LOGI(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, (tag), __VA_ARGS__)
347
362#define ESP_LOGD(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, (tag), __VA_ARGS__)
363
379#define ESP_LOGV(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_VERBOSE, (tag), __VA_ARGS__)
380
399#define ESP_EARLY_LOGE(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, (tag), __VA_ARGS__)
400
415#define ESP_EARLY_LOGW(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, (tag), __VA_ARGS__)
416
431#define ESP_EARLY_LOGI(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, (tag), __VA_ARGS__)
432
447#define ESP_EARLY_LOGD(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, (tag), __VA_ARGS__)
448
466#define ESP_EARLY_LOGV(tag, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_VERBOSE, (tag), __VA_ARGS__)
467
487#define ESP_LOG_BUFFER_HEXDUMP(tag, buf, len, level) \
488 do { \
489 if ((int)(level) <= (int)LOG_LOCAL_LEVEL) { \
490 ra8_esp_hosted_log_hexdump((int)(level), (tag), (buf), (uint32_t)(len)); \
491 } \
492 } while (0)
493
511/* NOLINTNEXTLINE(readability-identifier-naming) -- ESP-IDF-fixed lower-case spelling. */
512#define esp_log_level_set(tag, level) ra8_esp_hosted_log_level_set((tag), (int)(level))
513
535#define ESP_ERROR_CHECK(x) \
536 do { \
537 const int ra8_esp_hosted_rc_ = (int)(x); \
538 if (ra8_esp_hosted_rc_ != 0) { \
539 ra8_esp_hosted_log_fatal(TAG, #x, ra8_esp_hosted_rc_); \
540 } \
541 } while (0)
542
567#define ESP_ERROR_CHECK_WITHOUT_ABORT(x) \
568 do { \
569 const int ra8_esp_hosted_rc_ = (int)(x); \
570 if (ra8_esp_hosted_rc_ != 0) { \
571 ESP_LOGE(TAG, "%s returned 0x%x", #x, ra8_esp_hosted_rc_); \
572 } \
573 } while (0)
void ra8_esp_hosted_log_fatal(const char *tag, const char *expr, int code)
Report a failed ESP_ERROR_CHECK and stop.
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_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.
esp_log_level_t
Severity of one log line, ordered from silent to most verbose.
Definition esp_log.h:81
@ ESP_LOG_NONE
Threshold only: suppress every line.
Definition esp_log.h:82
@ ESP_LOG_WARN
Something unexpected that was handled anyway.
Definition esp_log.h:84
@ ESP_LOG_VERBOSE
Per-frame and per-edge tracing.
Definition esp_log.h:87
@ ESP_LOG_DEBUG
Detail useful while bringing a link up.
Definition esp_log.h:86
@ ESP_LOG_INFO
Normal life-cycle milestones.
Definition esp_log.h:85
@ ESP_LOG_ERROR
A fault the caller cannot recover from itself.
Definition esp_log.h:83