trace.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Squeezelite for esp32
  3. *
  4. * (c) Sebastien 2019
  5. * Philippe G. 2019, philippe_44@outlook.com
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. #pragma once
  22. #ifndef QUOTE
  23. #define QUOTE(name) #name
  24. #endif
  25. #ifndef STR
  26. #define STR(macro) QUOTE(macro)
  27. #endif
  28. #define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)
  29. #ifndef STR_OR_ALT
  30. #define STR_OR_ALT(str,alt) (str?str:alt)
  31. #endif
  32. extern const char unknown_string_placeholder[];
  33. extern const char * str_or_unknown(const char * str);
  34. #ifndef FREE_AND_NULL
  35. #define FREE_AND_NULL(x) if(x) { free(x); x=NULL; }
  36. #endif
  37. #ifndef CASE_TO_STR
  38. #define CASE_TO_STR(x) case x: return STR(x); break;
  39. #endif
  40. #define START_FREE_MEM_CHECK(a) size_t a=heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
  41. #define CHECK_RESET_FREE_MEM_CHECK(a,b) ESP_LOGV(__FUNCTION__ ,b "Mem used: %i",a-heap_caps_get_free_size(MALLOC_CAP_INTERNAL)); a=heap_caps_get_free_size(MALLOC_CAP_INTERNAL)