esp_timer_private.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 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. /**
  16. * @file esp_private/esp_timer_private.h
  17. *
  18. * @brief Interface between common and platform-specific parts of esp_timer.
  19. *
  20. * The functions in this header file are implemented for each supported SoC.
  21. * High level functions defined in esp_timer.c call the functions here to
  22. * interact with the hardware.
  23. *
  24. * Note: The functions from this file are marked as private and are used exclusively
  25. * inside the IDF in the power management and sleep files.
  26. */
  27. #include <stdint.h>
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /**
  32. * @brief Notify esp_timer implementation that APB frequency has changed
  33. *
  34. * Called by the frequency switching code.
  35. *
  36. * @param apb_ticks_per_us new number of APB clock ticks per microsecond
  37. */
  38. void esp_timer_private_update_apb_freq(uint32_t apb_ticks_per_us);
  39. /**
  40. * @brief Adjust current esp_timer time by a certain value
  41. *
  42. * Called from light sleep code to synchronize esp_timer time with RTC time.
  43. *
  44. * @param time_us adjustment to apply to esp_timer time, in microseconds
  45. */
  46. void esp_timer_private_advance(int64_t time_us);
  47. /**
  48. * @brief obtain internal critical section used esp_timer implementation
  49. * This can be used when a sequence of calls to esp_timer has to be made,
  50. * and it is necessary that the state of the timer is consistent between
  51. * the calls. Should be treated in the same way as a spinlock.
  52. * Call esp_timer_unlock to release the lock
  53. */
  54. void esp_timer_private_lock(void);
  55. /**
  56. * @brief counterpart of esp_timer_lock
  57. */
  58. void esp_timer_private_unlock(void);
  59. #ifdef __cplusplus
  60. }
  61. #endif