2019-07-15 21:07:00 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Centaur Analytics, Inc
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZEPHYR_DRIVERS_WATCHDOG_WWDG_STM32_H_
|
|
|
|
#define ZEPHYR_DRIVERS_WATCHDOG_WWDG_STM32_H_
|
|
|
|
|
|
|
|
#include <zephyr/types.h>
|
2022-05-06 16:25:46 +08:00
|
|
|
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
|
|
|
|
#include <zephyr/drivers/clock_control.h>
|
2019-07-15 21:07:00 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Driver for System Window Watchdog (WWDG) for STM32 MCUs
|
|
|
|
*
|
|
|
|
* The driver targets all STM32 SoCs. For details please refer to
|
|
|
|
* an appropriate reference manual and look for chapter called:
|
|
|
|
*
|
|
|
|
* System window watchdog (WWDG)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* driver configuration */
|
|
|
|
struct wwdg_stm32_config {
|
|
|
|
struct stm32_pclken pclken;
|
|
|
|
WWDG_TypeDef *Instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* driver data */
|
|
|
|
struct wwdg_stm32_data {
|
|
|
|
/* WWDG reset counter */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint8_t counter;
|
2019-07-15 21:07:00 +08:00
|
|
|
|
|
|
|
/* WWDG user defined callback on EWI */
|
|
|
|
wdt_callback_t callback;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define WWDG_STM32_CFG(dev) \
|
2020-05-29 02:44:16 +08:00
|
|
|
((const struct wwdg_stm32_config *const)(dev)->config)
|
2019-07-15 21:07:00 +08:00
|
|
|
|
|
|
|
#define WWDG_STM32_DATA(dev) \
|
2020-05-29 03:23:02 +08:00
|
|
|
((struct wwdg_stm32_data *const)(dev)->data)
|
2019-07-15 21:07:00 +08:00
|
|
|
|
|
|
|
#define WWDG_STM32_STRUCT(dev) \
|
|
|
|
((WWDG_TypeDef *)(WWDG_STM32_CFG(dev))->Instance)
|
|
|
|
|
|
|
|
#endif /* ZEPHYR_DRIVERS_WATCHDOG_WWDG_STM32_H_ */
|