portEXIT_CRITICAL(&twdt_spinlock);
return ESP_ERR_NOT_FOUND;
}
-
-void esp_task_wdt_feed(void)
-{
- portENTER_CRITICAL(&twdt_spinlock);
- //Return immediately if TWDT has not been initialized
- ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), VOID_RETURN);
-
- //Check if task is on list
- TaskHandle_t handle = xTaskGetCurrentTaskHandle();
- bool all_reset;
- twdt_task_t *target_task = find_task_in_twdt_list(handle, &all_reset);
-
- //reset the task if it's on the list, then return
- if(target_task != NULL){
- target_task->has_reset = true;
- if(all_reset){
- reset_hw_timer(); //Reset hardware timer if all other tasks have reset
- }
- portEXIT_CRITICAL(&twdt_spinlock);
- return;
- }
-
- //Add task if it's has not on list
- target_task = calloc(1, sizeof(twdt_task_t));
- ASSERT_EXIT_CRIT_RETURN((target_task != NULL), VOID_RETURN); //If calloc failed
- target_task->task_handle = handle;
- target_task->has_reset = true;
- target_task->next = NULL;
-
- if (twdt_config->list == NULL) { //Adding to empty list
- twdt_config->list = target_task;
- } else { //Adding to tail of list
- twdt_task_t *task;
- for (task = twdt_config->list; task->next != NULL; task = task->next){
- ; //point task to current tail of wdt task list
- }
- task->next = target_task;
- }
-
- portEXIT_CRITICAL(&twdt_spinlock);
-}
-
-
*/
esp_err_t esp_task_wdt_status(TaskHandle_t handle);
-/**
- * @brief Reset the TWDT on behalf of the current running task, or
- * subscribe the TWDT to if it has not done so already
- *
- * @warning This function is deprecated, use esp_task_wdt_add() and
- * esp_task_wdt_reset() instead
- *
- * This function is similar to esp_task_wdt_reset() and will reset the TWDT on
- * behalf of the current running task. However if this task has not subscribed
- * to the TWDT, this function will automatically subscribe the task. Therefore,
- * an unsubscribed task will subscribe to the TWDT on its first call to this
- * function, then proceed to reset the TWDT on subsequent calls of this
- * function.
- */
-void esp_task_wdt_feed(void) __attribute__ ((deprecated));
-
#ifdef __cplusplus
}