This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

reset support for at91


The attached patch adds true hardware reset support to the
at91 HAL.

tk

diff -ru hal-orig/arm/at91/var/current/ChangeLog hal/arm/at91/var/current/ChangeLog
--- hal-orig/arm/at91/var/current/ChangeLog	Thu May 15 18:52:51 2003
+++ hal/arm/at91/var/current/ChangeLog	Thu May 15 19:02:43 2003
@@ -1,3 +1,9 @@
+2003-05-15  Thomas Koeller  <thomas.koeller@baslerweb.com>
+
+	* include/hal_diag.h:
+	* src/at91_misc.c: Added function to generate a hardware reset
+	using the watchdog.
+	
 2003-05-12  Nick Garnett  <nickg@balti.calivar.com>
 
 	* src/at91_misc.c: Change definition of hal_IRQ_handler() to be
diff -ru hal-orig/arm/at91/var/current/include/hal_diag.h hal/arm/at91/var/current/include/hal_diag.h
--- hal-orig/arm/at91/var/current/include/hal_diag.h	Thu May 15 18:52:51 2003
+++ hal/arm/at91/var/current/include/hal_diag.h	Thu May 15 18:58:38 2003
@@ -44,7 +44,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):   jskov
-// Contributors:jskov, gthomas
+// Contributors:jskov, gthomas, tkoeller
 // Date:        2001-07-12
 // Purpose:     HAL Support for Kernel Diagnostic Routines
 // Description: Diagnostic routines for use during kernel development.
@@ -73,6 +73,11 @@
 
 extern void hal_delay_us(cyg_int32 usecs);
 #define HAL_DELAY_US(n) hal_delay_us(n);
+
+//-----------------------------------------------------------------------------
+// reset
+
+extern void hal_at91_reset_cpu(void);
 
 //-----------------------------------------------------------------------------
 // end of hal_diag.h
diff -ru hal-orig/arm/at91/var/current/src/at91_misc.c hal/arm/at91/var/current/src/at91_misc.c
--- hal-orig/arm/at91/var/current/src/at91_misc.c	Thu May 15 18:52:51 2003
+++ hal/arm/at91/var/current/src/at91_misc.c	Thu May 15 18:58:50 2003
@@ -42,7 +42,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    gthomas
-// Contributors: gthomas, jskov, nickg
+// Contributors: gthomas, jskov, nickg, tkoeller
 // Date:         2001-07-12
 // Purpose:      HAL board support
 // Description:  Implementations of HAL board interfaces
@@ -257,6 +257,16 @@
 //    UNDEFINED(__FUNCTION__);  // FIXME
 }
 
+
+/* Use the watchdog to generate a reset */
+void hal_at91_reset_cpu(void)
+{
+    HAL_WRITE_UINT32(AT91_WD + AT91_WD_OMR, AT91_WD_OMR_OKEY);
+    HAL_WRITE_UINT32(AT91_WD + AT91_WD_CMR, AT91_WD_CMR_CKEY);
+    HAL_WRITE_UINT32(AT91_WD + AT91_WD_CR, AT91_WD_CR_RSTKEY);
+    HAL_WRITE_UINT32(AT91_WD + AT91_WD_OMR, AT91_WD_OMR_OKEY | AT91_WD_OMR_RSTEN | AT91_WD_OMR_WDEN);
+    while(1) CYG_EMPTY_STATEMENT;
+}
 
 //--------------------------------------------------------------------------
 // EOF at91_misc.c

-- 

Thomas Koeller, Software Development

Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany

Phone	+49 (4102) 463-390
Fax	+49 (4102) 463-46390

mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]