drv_watch_dog.c 445 B

12345678910111213141516171819202122
  1. #include "common.h"
  2. #include "drv_watch_dog.h"
  3. void Watch_Dog_Initial(void)
  4. {
  5. /* enable IRC40K */
  6. rcu_osci_on(RCU_IRC40K);
  7. /* wait till IRC40K is ready */
  8. while(SUCCESS != rcu_osci_stab_wait(RCU_IRC40K)){
  9. }
  10. /* confiure FWDGT counter clock: 40KHz(IRC40K) / 64 = 0.625 KHz */
  11. fwdgt_config(4*625, FWDGT_PSC_DIV64);
  12. /* after 4 seconds to generate a reset */
  13. fwdgt_enable();
  14. }