yc11xx_wdt.c 525 B

123456789101112131415161718192021222324
  1. #include "yc11xx_wdt.h"
  2. #include "ycdef.h"
  3. void WDT_Enable(void)
  4. {
  5. HWRITE(mem_watchdog_enable,0x01);
  6. uint8_t config = *((volatile byte*)(0x10008043));
  7. config |= (1<<2);
  8. *((volatile byte*)(0x10008043)) = config;
  9. *((volatile byte*)(0x10008004)) = 0x2;
  10. }
  11. void WDT_Disable(void)
  12. {
  13. HWRITE(mem_watchdog_enable,0x00);
  14. uint8_t config = *((volatile byte*)(0x10008043));
  15. config &= (~(1<<2));
  16. *((volatile byte*)(0x10008043)) = config;
  17. }
  18. void WDT_Kick(void)
  19. {
  20. *((volatile byte*)(0x10008004)) = 0x2;
  21. }