1 /* 2 * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system. 7 * The header file used normally for ESP-IDF has the same name but is located elsewhere. 8 */ 9 #pragma once 10 11 #include <stdint.h> 12 #include <stdbool.h> 13 #include <stdio.h> 14 15 #include "sdkconfig.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #define heap_caps_malloc(a, b) NULL 22 #define MALLOC_CAP_INTERNAL 0 23 #define MALLOC_CAP_8BIT 0 24 25 #define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL 26 27 typedef enum { 28 ESP_LOG_NONE, /*!< No log output */ 29 ESP_LOG_ERROR, /*!< Critical errors, software module can not recover on its own */ 30 ESP_LOG_WARN, /*!< Error conditions from which recovery measures have been taken */ 31 ESP_LOG_INFO, /*!< Information messages which describe normal flow of events */ 32 ESP_LOG_DEBUG, /*!< Extra information which is not necessary for normal use (values, pointers, sizes, etc). */ 33 ESP_LOG_VERBOSE /*!< Bigger chunks of debugging information, or frequent messages which can potentially flood the output. */ 34 } esp_log_level_t; 35 36 #define LOG_COLOR_E 37 #define LOG_COLOR_W 38 #define LOG_COLOR_I 39 #define LOG_COLOR_D 40 #define LOG_COLOR_V 41 #define LOG_RESET_COLOR 42 43 #undef ESP_STATIC_ASSERT 44 #define ESP_STATIC_ASSERT(cond, message) 45 46 uint32_t esp_log_timestamp(void); 47 void esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) __attribute__ ((format (printf, 3, 4))); 48 49 #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n" 50 51 #define ESP_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } 52 53 #define ESP_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } 54 55 #define ESP_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } 56 57 #define ESP_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } 58 59 #define ESP_LOGV( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } 60 61 #define esp_flash_encryption_enabled() false 62 63 #ifdef __cplusplus 64 } 65 #endif 66