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 15 #pragma once 16 17 #include "sdkconfig.h" 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 typedef enum { 24 ESP_PM_TRACE_IDLE, 25 ESP_PM_TRACE_TICK, 26 ESP_PM_TRACE_FREQ_SWITCH, 27 ESP_PM_TRACE_CCOMPARE_UPDATE, 28 ESP_PM_TRACE_ISR_HOOK, 29 ESP_PM_TRACE_SLEEP, 30 ESP_PM_TRACE_TYPE_MAX 31 } esp_pm_trace_event_t; 32 33 void esp_pm_trace_init(void); 34 void esp_pm_trace_enter(esp_pm_trace_event_t event, int core_id); 35 void esp_pm_trace_exit(esp_pm_trace_event_t event, int core_id); 36 37 #ifdef CONFIG_PM_TRACE 38 39 #define ESP_PM_TRACE_ENTER(event, core_id) \ 40 esp_pm_trace_enter(ESP_PM_TRACE_ ## event, core_id) 41 #define ESP_PM_TRACE_EXIT(event, core_id) \ 42 esp_pm_trace_exit(ESP_PM_TRACE_ ## event, core_id) 43 44 #else // CONFIG_PM_TRACE 45 46 #define ESP_PM_TRACE_ENTER(type, core_id) do { (void) core_id; } while(0) 47 #define ESP_PM_TRACE_EXIT(type, core_id) do { (void) core_id; } while(0) 48 49 #endif // CONFIG_PM_TRACE 50 51 #ifdef __cplusplus 52 } 53 #endif 54