esp-idf/components/hal/include/hal/xt_wdt_hal.h
Planck (Lu Zeyu) 333553caf2 fix(hal): check the public header files and fix violations
fix(hal/include): fix header violations in hal component
fix(hal/include): Move type definitions from `xx_hal.h` to `xx_types.h`
fix(hal/include): Move type definitions from `xx_hal.h` to `xx_types.h`
fix(hal/include): Add comment for a far away `#endif`
fix(hal/include): change scope for cpp guard
ci: Remove components/hal/ comment from public headers check exceptions
Add missing include macro sdkconfig.h for header files
Add missing include macro stdbool.h for header files
Add missing include macro stdint.h for header files
Add missing capability guard macro for header files
Add missing cpp guard macro for header files
Remove some useless include macros
Add some missing `inline` attribute for functions defined in header files
Remove components/hal/ from public headers check exceptions
fix(hal/include): fix invalid licenses
fix(hal/include): fix invalid licenses
fix(hal/include): add missing soc_caps.h
fix(hal): include soc_caps.h before cap macro is used
fix(hal): Remove unnecessary target check
fix(hal): fix header and macro problems
Add missing include macro
Remove loop dependency in hal
Add comment for far-away endif
fix(hal): Add missing soc_caps.h
ci: update check_copyright_ignore.txt
Change the sequence of `#include` macro, cpp guard macro
Change the wrap scope of capacity macro

fix(hal): Change position of C++ guard to pass test
2023-07-05 17:33:32 +08:00

71 lines
1.7 KiB
C

/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "soc/soc_caps.h"
#if SOC_XT_WDT_SUPPORTED
#include "hal/xt_wdt_ll.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if SOC_XT_WDT_SUPPORTED
typedef struct {
rtc_cntl_dev_t *dev; /* Pointer to the RTC register struct */
} xt_wdt_hal_context_t; /* HAL context struct */
typedef struct {
uint32_t timeout; /* Watchdog timer timeout in RTC_CLK cycles */
} xt_wdt_hal_config_t; /* HAL config parameter struct */
/* ---------------------------- Init and Config ----------------------------- */
/**
* @brief Initialize the WDTs associated HAL context
*
* Prepares the register for enabling the WDT and sets the timeout value
*
* @param hal Pointer to the HAL layer context
* @param config Pointer to config struct
*/
void xt_wdt_hal_init(xt_wdt_hal_context_t *hal, const xt_wdt_hal_config_t *config);
/**
* @brief Enable or disable the WDT
*
* @param hal Pointer to the HAL layer context
* @param enable true for enable WDT, false for disable
*/
void xt_wdt_hal_enable(xt_wdt_hal_context_t *hal, bool enable);
/**
* @brief Enable the automatic RTC backup clock with the given frequency
*
* Calculates and sets the necessary hardware parameters to meet the desired
* backup clock frequency
*
* @param hal Pointer to the HAL layer context
* @param rtc_clk_frequency_khz desired frequency for the backup clock
* @return uint32_t the calculated clock factor value
*/
uint32_t xt_wdt_hal_enable_backup_clk(xt_wdt_hal_context_t *hal, uint32_t rtc_clk_frequency_khz);
#endif
#ifdef __cplusplus
}
#endif