pm_trace.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "sdkconfig.h"
  16. typedef enum {
  17. ESP_PM_TRACE_IDLE,
  18. ESP_PM_TRACE_TICK,
  19. ESP_PM_TRACE_FREQ_SWITCH,
  20. ESP_PM_TRACE_CCOMPARE_UPDATE,
  21. ESP_PM_TRACE_ISR_HOOK,
  22. ESP_PM_TRACE_SLEEP,
  23. ESP_PM_TRACE_TYPE_MAX
  24. } esp_pm_trace_event_t;
  25. void esp_pm_trace_init(void);
  26. void esp_pm_trace_enter(esp_pm_trace_event_t event, int core_id);
  27. void esp_pm_trace_exit(esp_pm_trace_event_t event, int core_id);
  28. #ifdef CONFIG_PM_TRACE
  29. #define ESP_PM_TRACE_ENTER(event, core_id) \
  30. esp_pm_trace_enter(ESP_PM_TRACE_ ## event, core_id)
  31. #define ESP_PM_TRACE_EXIT(event, core_id) \
  32. esp_pm_trace_exit(ESP_PM_TRACE_ ## event, core_id)
  33. #else // CONFIG_PM_TRACE
  34. #define ESP_PM_TRACE_ENTER(type, core_id) do { (void) core_id; } while(0)
  35. #define ESP_PM_TRACE_EXIT(type, core_id) do { (void) core_id; } while(0)
  36. #endif // CONFIG_PM_TRACE