You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.5 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #pragma once
  2. #include <stdio.h>
  3. #include "basic_h/basic.hpp"
  4. //
  5. #include "clock.hpp"
  6. extern "C" {
  7. extern bool g_enable_log;
  8. #define ZLOG_RELEASE(TAG, fmt, ...) \
  9. if (g_enable_log) { \
  10. printf(TAG "" fmt "\n", ##__VA_ARGS__); \
  11. }
  12. #define ZLOGI(TAG, fmt, ...) \
  13. if (g_enable_log) { \
  14. printf("%08lu INFO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
  15. }
  16. #define ZLOGD(TAG, fmt, ...) \
  17. if (g_enable_log) { \
  18. printf("%08lu DEBU [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
  19. }
  20. #define ZLOGE(TAG, fmt, ...) \
  21. if (g_enable_log) { \
  22. printf("%08lu ERRO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
  23. }
  24. #define ZASSERT(cond) \
  25. if (!(cond)) { \
  26. while (1) { \
  27. printf("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \
  28. zchip_clock_early_delayus(1000 * 1000); \
  29. } \
  30. }
  31. void zchip_loggger_init(zchip_uart_t *huart);
  32. void zchip_loggger_enable(bool enable);
  33. }