1 /* 2 * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 /** 10 * @file esp_private/esp_timer_private.h 11 * 12 * @brief Interface between common and platform-specific parts of esp_timer. 13 * 14 * The functions in this header file are implemented for each supported SoC. 15 * High level functions defined in esp_timer.c call the functions here to 16 * interact with the hardware. 17 * 18 * Note: The functions from this file are marked as private and are used exclusively 19 * inside the IDF in the power management and sleep files. 20 */ 21 22 #include <stdint.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /** 29 * @brief Notify esp_timer implementation that APB frequency has changed 30 * 31 * Called by the frequency switching code. 32 * 33 * @param apb_ticks_per_us new number of APB clock ticks per microsecond 34 */ 35 void esp_timer_private_update_apb_freq(uint32_t apb_ticks_per_us); 36 37 /** 38 * @brief Set esp_timer time to a certain value 39 * 40 * Called from light sleep code to synchronize esp_timer time with RTC time. 41 * 42 * @param new_us the value to be set to esp_timer time, in microseconds 43 */ 44 void esp_timer_private_set(uint64_t new_us); 45 46 /** 47 * @brief Adjust current esp_timer time by a certain value 48 * 49 * @param time_diff_us adjustment to apply to esp_timer time, in microseconds 50 */ 51 void esp_timer_private_advance(int64_t time_diff_us); 52 53 /** 54 * @brief obtain internal critical section used in the esp_timer implementation 55 * This can be used when a sequence of calls to esp_timer has to be made, 56 * and it is necessary that the state of the timer is consistent between 57 * the calls. Should be treated in the same way as a spinlock. 58 * Call esp_timer_private_unlock to release the lock 59 */ 60 void esp_timer_private_lock(void); 61 62 /** 63 * @brief counterpart of esp_timer_lock 64 */ 65 void esp_timer_private_unlock(void); 66 67 #ifdef __cplusplus 68 } 69 #endif 70