An implementation of the mc1322x watchdog

This commit is contained in:
Adam Dunkels 2013-11-22 15:54:06 +01:00
parent 88f9d79053
commit 7a310935d8

View file

@ -34,30 +34,38 @@
*/ */
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include <mc1322x.h>
#include <board.h>
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_init(void) watchdog_init(void)
{ {
cop_timeout_ms(1000);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_start(void) watchdog_start(void)
{ {
CRM->COP_CNTLbits.COP_EN = 1;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_periodic(void) watchdog_periodic(void)
{ {
cop_service();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_stop(void) watchdog_stop(void)
{ {
CRM->COP_CNTLbits.COP_EN = 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_reboot(void) watchdog_reboot(void)
{ {
watchdog_start();
while(1);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/