PERFORCE change 103389 for review
Warner Losh
imp at FreeBSD.org
Mon Aug 7 19:05:01 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=103389
Change 103389 by imp at imp_bugs on 2006/08/07 19:04:23
Implement watchdog. The OS has 30s to load and get to the point
of disabling the watchdog before we reboot. 64s is the absolute
max, and 30s seemed a good number. Usually it takes like 5s-10s.
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#13 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/reset.c#2 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#13 (text) ====
@@ -40,7 +40,8 @@
/* XMODEM protocol */
int xmodem_rx(char *dst);
-/* Reboot! Reset! */
+/* */
+void start_wdog(void);
void reset(void);
/* Delay us */
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/reset.c#2 (text+ko) ====
@@ -28,10 +28,11 @@
#include "lib.h"
/*
- * int getc(int seconds)
+ * void reset()
*
- * Reads a character from the DBGU port, if one is available within about
- * seconds seconds. It assumes that DBGU has already been initialized.
+ * Forces a reset of the system. Uses watchdog timer of '1', which
+ * corresponds to 128 / SLCK seconds (SLCK is 32,768 Hz, so 128/32768 is
+ * 1 / 256 ~= 5.4ms
*/
void
reset(void)
@@ -40,3 +41,17 @@
AT91C_BASE_ST->ST_WDMR = 1 | AT91C_ST_RSTEN;
AT91C_BASE_ST->ST_CR = AT91C_ST_WDRST;
}
+
+/*
+ * void start_wdog()
+ *
+ * Starts a watchdog timer. We force the boot process to get to the point
+ * it can kick the watch dog part of the ST part for the OS's driver.
+ */
+void
+start_wdog(void)
+{
+ // The following should effect a reset after 30 seconds.
+ AT91C_BASE_ST->ST_WDMR = (30 * (32768 / 128)) | AT91C_ST_RSTEN;
+ AT91C_BASE_ST->ST_CR = AT91C_ST_WDRST;
+}
More information about the p4-projects
mailing list