This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
bl_mcu_sdk/examples/bflog/freertos_async/example_log.h
jzlv 356f258e83 [sync] sync from internal repo
* use nuttx libc, disable system libc
* use tlsf as default
* update lhal flash driver
* add example readme
* add flash ini for new flash tool
* add fw header for new flash tool
2023-01-17 21:04:07 +08:00

60 lines
2.0 KiB
C

#ifndef _EXAMPLE_LOG_H
#define _EXAMPLE_LOG_H
#include <stdint.h>
#include <string.h>
#include "bflog.h"
extern bflog_t example_recorder;
#define LOG_F(...) BFLOG_F((void *)&example_recorder, __VA_ARGS__)
#define LOG_E(...) BFLOG_E((void *)&example_recorder, __VA_ARGS__)
#define LOG_W(...) BFLOG_W((void *)&example_recorder, __VA_ARGS__)
#define LOG_I(...) BFLOG_I((void *)&example_recorder, __VA_ARGS__)
#define LOG_D(...) BFLOG_D((void *)&example_recorder, __VA_ARGS__)
#define LOG_T(...) BFLOG_T((void *)&example_recorder, __VA_ARGS__)
#define LOG_FLUSH() bflog_flush(&example_recorder)
extern void error_handler(void);
#ifdef CONFIG_ASSERT_DISABLE
#define _ASSERT_PARAM(x) ((void)(0))
#define _ASSERT_FUNC(x) ((void)(x))
#define _CALL_ERROR() error_handler()
#else
#define _CALL_ERROR() \
do { \
printf("(Call Error Handler)\r\n"); \
LOG_F("Call Error Handler\r\n"); \
LOG_FLUSH(); \
error_handler(); \
} while (0)
#define _ASSERT_PARAM(x) \
if ((uint32_t)(x) == 0) { \
printf("(Assertion Faild)\r\n"); \
printf("(%s)\r\n", (const char *)(#x)); \
LOG_F("Assertion Faild\r\n"); \
LOG_F("%s\r\n", (const char *)(#x)); \
LOG_FLUSH(); \
error_handler(); \
}
#define _ASSERT_FUNC(x) \
do { \
if ((uint32_t)(x) == 0) { \
printf("(Assertion Faild)\r\n"); \
printf("(%s)\r\n", (const char *)(#x)); \
LOG_F("Assertion Faild\r\n"); \
LOG_F("%s\r\n", (const char *)(#x)); \
LOG_FLUSH(); \
error_handler(); \
} \
} while (0)
#endif
#endif