debug_uart.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef DEBUG_UART_H_
  2. #define DEBUG_UART_H_
  3. #include "util.h"
  4. #include "fixpt.h"
  5. #include <stdint.h>
  6. #if CONF_DEBUG
  7. #define DEBUG_PREFIX1(prefix0) prefix0, NULL
  8. #define DEBUG_PREFIX2(prefix0, prefix1) prefix0, prefix1
  9. #define DEBUG_PFX1(prefix0) DEBUG_PREFIX1(PSTR(prefix0))
  10. #define DEBUG_PFX2(prefix0, prefix1) DEBUG_PREFIX2(PSTR(prefix0), PSTR(prefix1))
  11. void debug_print_int32(const char __flash *prefix0,
  12. const char __flash *prefix1,
  13. int32_t value);
  14. void debug_print_int24(const char __flash *prefix0,
  15. const char __flash *prefix1,
  16. int24_t value);
  17. void debug_print_int16(const char __flash *prefix0,
  18. const char __flash *prefix1,
  19. int16_t value);
  20. void debug_print_int8(const char __flash *prefix0,
  21. const char __flash *prefix1,
  22. int8_t value);
  23. void debug_print_fixpt(const char __flash *prefix0,
  24. const char __flash *prefix1,
  25. fixpt_t value);
  26. void debug_report_int32(const char __flash *prefix0,
  27. const char __flash *prefix1,
  28. int32_t *old_value,
  29. int32_t new_value);
  30. void debug_report_int24(const char __flash *prefix0,
  31. const char __flash *prefix1,
  32. int24_t *old_value,
  33. int24_t new_value);
  34. void debug_report_int16(const char __flash *prefix0,
  35. const char __flash *prefix1,
  36. int16_t *old_value,
  37. int16_t new_value);
  38. void debug_report_int8(const char __flash *prefix0,
  39. const char __flash *prefix1,
  40. int8_t *old_value,
  41. int8_t new_value);
  42. void debug_report_fixpt(const char __flash *prefix0,
  43. const char __flash *prefix1,
  44. fixpt_t *old_value,
  45. fixpt_t new_value);
  46. void debug_enable(bool enable);
  47. bool debug_is_enabled(void);
  48. void debug_uart_init(void);
  49. #else /* CONF_DEBUG */
  50. #define DEBUG_PREFIX1(prefix0) NULL, NULL
  51. #define DEBUG_PREFIX2(prefix0, prefix1) NULL, NULL
  52. #define DEBUG_PFX1(prefix0) DEBUG_PREFIX1(NULL)
  53. #define DEBUG_PFX2(prefix0, prefix1) DEBUG_PREFIX2(NULL, NULL)
  54. static inline
  55. void debug_print_int32(const char __flash *prefix0,
  56. const char __flash *prefix1,
  57. int32_t value)
  58. {
  59. }
  60. static inline
  61. void debug_print_int24(const char __flash *prefix0,
  62. const char __flash *prefix1,
  63. int24_t value)
  64. {
  65. }
  66. static inline
  67. void debug_print_int16(const char __flash *prefix0,
  68. const char __flash *prefix1,
  69. int16_t value)
  70. {
  71. }
  72. static inline
  73. void debug_print_int8(const char __flash *prefix0,
  74. const char __flash *prefix1,
  75. int8_t value)
  76. {
  77. }
  78. static inline
  79. void debug_print_fixpt(const char __flash *prefix0,
  80. const char __flash *prefix1,
  81. fixpt_t value)
  82. {
  83. }
  84. static inline
  85. void debug_report_int32(const char __flash *prefix0,
  86. const char __flash *prefix1,
  87. int32_t *old_value,
  88. int32_t new_value)
  89. {
  90. }
  91. static inline
  92. void debug_report_int24(const char __flash *prefix0,
  93. const char __flash *prefix1,
  94. int24_t *old_value,
  95. int24_t new_value)
  96. {
  97. }
  98. static inline
  99. void debug_report_int16(const char __flash *prefix0,
  100. const char __flash *prefix1,
  101. int16_t *old_value,
  102. int16_t new_value)
  103. {
  104. }
  105. static inline
  106. void debug_report_int8(const char __flash *prefix0,
  107. const char __flash *prefix1,
  108. int8_t *old_value,
  109. int8_t new_value)
  110. {
  111. }
  112. static inline
  113. void debug_report_fixpt(const char __flash *prefix0,
  114. const char __flash *prefix1,
  115. fixpt_t *old_value,
  116. fixpt_t new_value)
  117. {
  118. }
  119. static inline
  120. void debug_enable(bool enable)
  121. {
  122. }
  123. static inline
  124. bool debug_is_enabled(void)
  125. {
  126. return false;
  127. }
  128. static inline
  129. void debug_uart_init(void)
  130. {
  131. }
  132. #endif /* CONF_DEBUG */
  133. #endif /* DEBUG_UART_H_ */