drv_wdt.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-07-28 songchao first version
  9. */
  10. #ifndef __WATCHDOG_H__
  11. #define __WATCHDOG_H__
  12. #include <rtthread.h>
  13. #include "fsl_wdog.h"
  14. #define RT_DEVICE_CTRL_WDT_GET_TIMEOUT (1) /* get timeout(in seconds) */
  15. #define RT_DEVICE_CTRL_WDT_SET_TIMEOUT (2) /* set timeout(in seconds) */
  16. #define RT_DEVICE_CTRL_WDT_GET_TIMELEFT (3) /* get the left time before reboot(in seconds) */
  17. #define RT_DEVICE_CTRL_WDT_KEEPALIVE (4) /* refresh watchdog */
  18. #define RT_DEVICE_CTRL_WDT_START (5) /* start watchdog */
  19. #define RT_DEVICE_CTRL_WDT_STOP (6) /* stop watchdog */
  20. struct rt_watchdog_ops;
  21. struct rt_watchdog_device
  22. {
  23. struct rt_device parent;
  24. const struct rt_watchdog_ops *ops;
  25. const char *name;
  26. rt_uint32_t paddr;
  27. rt_uint32_t vaddr;
  28. rt_uint32_t irqno;
  29. wdog_config_t *config;
  30. };
  31. typedef struct rt_watchdog_device rt_watchdog_t;
  32. struct rt_watchdog_ops
  33. {
  34. rt_err_t (*init)(rt_watchdog_t *wdt);
  35. rt_err_t (*control)(rt_watchdog_t *wdt, int cmd, void *arg);
  36. };
  37. rt_err_t rt_hw_watchdog_register(rt_watchdog_t *wdt,
  38. const char *name,
  39. rt_uint32_t flag,
  40. void *data);
  41. #endif /* __WATCHDOG_H__ */