pm_trace.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. typedef enum {
  20. ESP_PM_TRACE_IDLE,
  21. ESP_PM_TRACE_TICK,
  22. ESP_PM_TRACE_FREQ_SWITCH,
  23. ESP_PM_TRACE_CCOMPARE_UPDATE,
  24. ESP_PM_TRACE_ISR_HOOK,
  25. ESP_PM_TRACE_SLEEP,
  26. ESP_PM_TRACE_TYPE_MAX
  27. } esp_pm_trace_event_t;
  28. void esp_pm_trace_init(void);
  29. void esp_pm_trace_enter(esp_pm_trace_event_t event, int core_id);
  30. void esp_pm_trace_exit(esp_pm_trace_event_t event, int core_id);
  31. #ifdef CONFIG_PM_TRACE
  32. #define ESP_PM_TRACE_ENTER(event, core_id) \
  33. esp_pm_trace_enter(ESP_PM_TRACE_ ## event, core_id)
  34. #define ESP_PM_TRACE_EXIT(event, core_id) \
  35. esp_pm_trace_exit(ESP_PM_TRACE_ ## event, core_id)
  36. #else // CONFIG_PM_TRACE
  37. #define ESP_PM_TRACE_ENTER(type, core_id) do { (void) core_id; } while(0)
  38. #define ESP_PM_TRACE_EXIT(type, core_id) do { (void) core_id; } while(0)
  39. #endif // CONFIG_PM_TRACE
  40. #ifdef __cplusplus
  41. }
  42. #endif