trace.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2019 Actions Semi Co., Inc.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief trace file APIs.
  9. */
  10. #ifndef TRACE_H_
  11. #define TRACE_H_
  12. typedef enum
  13. {
  14. TRACE_MODE_DISABLE = 0,
  15. TRACE_MODE_CPU,
  16. TRACE_MODE_DMA,
  17. }trace_mode_e;
  18. int trace_mode_set(unsigned int trace_mode);
  19. int trace_irq_print_set(unsigned int irq_enable);
  20. int trace_dma_print_set(unsigned int dma_enable);
  21. #ifdef CONFIG_TRACE_EVENT
  22. /* task trace function */
  23. extern void _trace_task_switch(struct k_thread *from, struct k_thread *to);
  24. /* malloc trace function */
  25. extern void _trace_malloc(uint32_t address, uint32_t malloc_size, uint32_t caller);
  26. extern void _trace_free(uint32_t address, uint32_t caller);
  27. /* task trace */
  28. #define TRACE_TASK_SWITCH(from, to) _trace_task_switch(from, to)
  29. /* malloc trace */
  30. #define TRACE_MALLOC(address, size, caller) _trace_malloc(address, size, caller)
  31. #define TRACE_FREE(address, caller) _trace_free(address, caller)
  32. #else
  33. /* task trace */
  34. #define TRACE_TASK_SWITCH(from, to)
  35. /* malloc trace */
  36. #define TRACE_MALLOC(address, size, caller)
  37. #define TRACE_FREE(address, caller)
  38. #endif
  39. #endif /* TRACE_H_ */