#use "default.h"

#if (BOARD_TYPE!=LittleG)
#fatal "This program only runs on the BL16xx/LittleG."
#endif

/*
	GENWDOG.C
	
   Sample program to show how to monitor for a watchdog timeout on start_up.

   Compile and run the program with jumper JP1 27-28 connected. The watchdog
   will timeout and lose communication with Dyanamic C. Recompile and run
   the program and observe the stdio window.
*/

unsigned int waitcount;
unsigned int runcount;

main()
{
    waitcount = runcount = 0;

    if( wderror() )
    {
        printf("At least one watchdog time out has been generated.\n");
        printf("Monitor waitcount and runcount through the watch window.\n");
        while(1)
        {
            runcount++;
            hitwd();
            runwatch();
        }
    }
    else
    {
        printf("Force a watch dog timeout.\n"); 
        printf("Make sure JP1 27-28 are connected.\n");
        printf("Monitor waitcount and runcount through the watch window.\n");     
        while(1)
        {    
            runwatch();
            waitcount++;
        }
    }
}
