Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sa11x0 Added watchdog timer reset function.



details:   https://anonhg.NetBSD.org/src/rev/5b17b9f0e361
branches:  trunk
changeset: 780941:5b17b9f0e361
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Sun Aug 12 17:21:29 2012 +0000

description:
Added watchdog timer reset function.

diffstat:

 sys/arch/arm/sa11x0/sa11x0_ost.c    |  26 ++++++++++++++++++++++++--
 sys/arch/arm/sa11x0/sa11x0_ostvar.h |   8 ++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diffs (63 lines):

diff -r eafb44febd71 -r 5b17b9f0e361 sys/arch/arm/sa11x0/sa11x0_ost.c
--- a/sys/arch/arm/sa11x0/sa11x0_ost.c  Sun Aug 12 17:20:19 2012 +0000
+++ b/sys/arch/arm/sa11x0/sa11x0_ost.c  Sun Aug 12 17:21:29 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sa11x0_ost.c,v 1.29 2011/07/01 20:31:39 dyoung Exp $   */
+/*     $NetBSD: sa11x0_ost.c,v 1.30 2012/08/12 17:21:29 nonaka Exp $   */
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.29 2011/07/01 20:31:39 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.30 2012/08/12 17:21:29 nonaka Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -56,6 +56,7 @@
 #include <arm/sa11x0/sa11x0_reg.h> 
 #include <arm/sa11x0/sa11x0_var.h>
 #include <arm/sa11x0/sa11x0_ostreg.h>
+#include <arm/sa11x0/sa11x0_ostvar.h>
 
 static int     saost_match(device_t, cfdata_t, void *);
 static void    saost_attach(device_t, device_t, void *);
@@ -327,3 +328,24 @@
                otick = xtick;
        }
 }
+
+void
+saost_reset(void)
+{
+       struct saost_softc *sc = saost_sc;
+       uint32_t counter;
+       uint32_t saved_ints;
+
+       saved_ints = disable_interrupts(I32_bit|F32_bit);
+
+       counter = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SAOST_CR);
+       counter += TIMER_FREQUENCY;
+       bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_MR3, counter);
+
+       /* Enable watchdog */
+       bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_WR, 1);
+
+       delay(1 * 1000 * 1000);
+
+       restore_interrupts(saved_ints);
+}
diff -r eafb44febd71 -r 5b17b9f0e361 sys/arch/arm/sa11x0/sa11x0_ostvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/sa11x0/sa11x0_ostvar.h       Sun Aug 12 17:21:29 2012 +0000
@@ -0,0 +1,8 @@
+/*     $NetBSD: sa11x0_ostvar.h,v 1.1 2012/08/12 17:21:29 nonaka Exp $ */
+
+#ifndef _SA11X0_OSTVAR_H
+#define _SA11X0_OSTVAR_H
+
+void saost_reset(void);
+
+#endif /* _SA11X0_OSTVAR_H */



Home | Main Index | Thread Index | Old Index