systimer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. // we assign the systimer resources statically
  9. #define SYSTIMER_COUNTER_ESPTIMER 0 // Counter used by esptimer, to generate the system level wall clock
  10. #define SYSTIMER_COUNTER_OS_TICK 1 // Counter used by RTOS porting layer, to generate the OS tick
  11. #define SYSTIMER_ALARM_OS_TICK_CORE0 0 // Alarm used by OS tick, dedicated for core 0
  12. #define SYSTIMER_ALARM_OS_TICK_CORE1 1 // Alarm used by OS tick, dedicated for core 1
  13. #define SYSTIMER_ALARM_ESPTIMER 2 // Alarm used by esptimer
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * @brief Convert ticks to microseconds
  19. *
  20. * @param ticks ticks to convert
  21. * @return microseconds
  22. */
  23. uint64_t systimer_ticks_to_us(uint64_t ticks) __attribute__((const));
  24. /**
  25. * @brief Convert microseconds to ticks
  26. *
  27. * @param us microseconds to convert
  28. * @return ticks
  29. */
  30. uint64_t systimer_us_to_ticks(uint64_t us) __attribute__((const));
  31. #ifdef __cplusplus
  32. }
  33. #endif