esp_task_wdt_impl.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_err.h"
  8. #include "../esp_task_wdt.h"
  9. #include "esp_private/esp_task_wdt.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @brief Allocate and initialize the Task Watchdog Timer (TWDT) with the given configuration.
  15. *
  16. * @param[in] config Pointer to the configuration structure
  17. * @param[out] obj Abstract context for the current timer, this will be passed to all the other functions
  18. *
  19. * @return
  20. * - ESP_OK: Successfully initialized and configured the timer
  21. * - Other: Failed to initialize the timer
  22. */
  23. esp_err_t esp_task_wdt_impl_timer_allocate(const esp_task_wdt_config_t *config,
  24. twdt_isr_callback callback,
  25. twdt_ctx_t *obj);
  26. /**
  27. * @brief Reconfigure a timer.
  28. *
  29. * The timer must be stopped when calling this function. The timer will not be restarted at the end of this
  30. * function.
  31. *
  32. * @param[in] config Pointer to the configuration structure
  33. *
  34. * @return
  35. * - ESP_OK: Successfully reconfigured the timer
  36. * - Other: Failed to reconfigure the timer
  37. */
  38. esp_err_t esp_task_wdt_impl_timer_reconfigure(twdt_ctx_t obj, const esp_task_wdt_config_t *config);
  39. /**
  40. * @brief Free the Task Watchdog Timer (TWDT).
  41. *
  42. * @param[in] obj Abstract implementation context
  43. *
  44. */
  45. void esp_task_wdt_impl_timer_free(twdt_ctx_t obj);
  46. /**
  47. * @brief Feed the Task Watchdog Timer (TWDT)
  48. *
  49. * Feed the timer underneath to prevent it from triggering for the next period (configured at initialization).
  50. *
  51. * @param[in] obj Abstract implementation context
  52. * @return
  53. * - ESP_OK: timer successfully feeded
  54. * - Other: failed to feed the timer
  55. */
  56. esp_err_t esp_task_wdt_impl_timer_feed(twdt_ctx_t obj);
  57. /**
  58. * @brief Function invoked as soon as the Task Watchdog Timer (TWDT) ISR callback is called.
  59. *
  60. * @param[in] obj Abstract implementation context
  61. */
  62. void esp_task_wdt_impl_timeout_triggered(twdt_ctx_t obj);
  63. /**
  64. * @brief Stop the Task Watchdog Timer (TWDT).
  65. *
  66. * @param[in] obj Abstract implementation context
  67. *
  68. */
  69. esp_err_t esp_task_wdt_impl_timer_stop(twdt_ctx_t obj);
  70. /**
  71. * @brief Restart the Task Watchdog Timer (TWDT)
  72. *
  73. * This function will restart/resume the timer after it has been stopped.
  74. *
  75. * @param[in] obj Abstract implementation context
  76. * @return
  77. * - ESP_OK: timer successfully stopped
  78. * - Other: failed to stop the timer
  79. */
  80. esp_err_t esp_task_wdt_impl_timer_restart(twdt_ctx_t obj);
  81. #ifdef __cplusplus
  82. }
  83. #endif