Go to the documentation of this file.
31#ifndef __VSF_ESPIDF_ESP_CHECK_H__
32#define __VSF_ESPIDF_ESP_CHECK_H__
47# define ESP_EARLY_LOGE(tag, format, ...) \
48 ESP_LOGE(tag, format, ##__VA_ARGS__)
55#define ESP_RETURN_ON_ERROR(x, log_tag, format, ...) do { \
56 esp_err_t err_rc_ = (x); \
57 if (unlikely(err_rc_ != ESP_OK)) { \
58 ESP_LOGE(log_tag, "%s(%d): " format, \
59 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
64#define ESP_RETURN_ON_ERROR_ISR(x, log_tag, format, ...) do { \
65 esp_err_t err_rc_ = (x); \
66 if (unlikely(err_rc_ != ESP_OK)) { \
67 ESP_EARLY_LOGE(log_tag, "%s(%d): " format, \
68 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
77#define ESP_RETURN_VOID_ON_ERROR(x, log_tag, format, ...) do { \
78 esp_err_t err_rc_ = (x); \
79 if (unlikely(err_rc_ != ESP_OK)) { \
80 ESP_LOGE(log_tag, "%s(%d): " format, \
81 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
86#define ESP_RETURN_VOID_ON_ERROR_ISR(x, log_tag, format, ...) do { \
87 esp_err_t err_rc_ = (x); \
88 if (unlikely(err_rc_ != ESP_OK)) { \
89 ESP_EARLY_LOGE(log_tag, "%s(%d): " format, \
90 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
99#define ESP_GOTO_ON_ERROR(x, goto_tag, log_tag, format, ...) do { \
100 esp_err_t err_rc_ = (x); \
101 if (unlikely(err_rc_ != ESP_OK)) { \
102 ESP_LOGE(log_tag, "%s(%d): " format, \
103 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
109#define ESP_GOTO_ON_ERROR_ISR(x, goto_tag, log_tag, format, ...) do { \
110 esp_err_t err_rc_ = (x); \
111 if (unlikely(err_rc_ != ESP_OK)) { \
112 ESP_EARLY_LOGE(log_tag, "%s(%d): " format, \
113 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
123#define ESP_RETURN_ON_FALSE(a, err_code, log_tag, format, ...) do { \
124 if (unlikely(!(a))) { \
125 ESP_LOGE(log_tag, "%s(%d): " format, \
126 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
131#define ESP_RETURN_ON_FALSE_ISR(a, err_code, log_tag, format, ...) do { \
132 if (unlikely(!(a))) { \
133 ESP_EARLY_LOGE(log_tag, "%s(%d): " format, \
134 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
143#define ESP_RETURN_VOID_ON_FALSE(a, log_tag, format, ...) do { \
144 if (unlikely(!(a))) { \
145 ESP_LOGE(log_tag, "%s(%d): " format, \
146 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
151#define ESP_RETURN_VOID_ON_FALSE_ISR(a, log_tag, format, ...) do { \
152 if (unlikely(!(a))) { \
153 ESP_EARLY_LOGE(log_tag, "%s(%d): " format, \
154 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
163#define ESP_GOTO_ON_FALSE(a, err_code, goto_tag, log_tag, format, ...) do { \
164 if (unlikely(!(a))) { \
165 ESP_LOGE(log_tag, "%s(%d): " format, \
166 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
172#define ESP_GOTO_ON_FALSE_ISR(a, err_code, goto_tag, log_tag, format, ...) do { \
173 if (unlikely(!(a))) { \
174 ESP_EARLY_LOGE(log_tag, "%s(%d): " format, \
175 __FUNCTION__, __LINE__, ##__VA_ARGS__); \
185#define ESP_RETURN_ON_ERROR_CLEANUP(x, ...) do { \
186 esp_err_t err_rc_ = (x); \
187 if (unlikely(err_rc_ != ESP_OK)) { \