|
@@ -0,0 +1,29 @@
|
|
|
+#!/bin/sh
|
|
|
+
|
|
|
+if [ $# -lt 1 ]; then
|
|
|
+ echo "Usage sample: check_reset_reason.sh [Action]"
|
|
|
+ echo " Action: read / clear"
|
|
|
+ exit 0;
|
|
|
+else
|
|
|
+ case $1 in
|
|
|
+ read)
|
|
|
+ reason=`devmem 0x44e00f08`
|
|
|
+ echo "CPU reset reason register:" $reason
|
|
|
+ echo "Bit[0]: Power-on (cold) reset event"
|
|
|
+ echo "Bit[1]: Global warm software reset event"
|
|
|
+ echo "Bit[2]: Reserved"
|
|
|
+ echo "Bit[3]: Reserved"
|
|
|
+ echo "Bit[4]: Watchdog1 timer reset event"
|
|
|
+ echo "Bit[5]: External warm reset event"
|
|
|
+ echo "Bit[6]: Reserved"
|
|
|
+ echo "Bit[7]: Reserved"
|
|
|
+ echo "Bit[8]: Reserved"
|
|
|
+ echo "Bit[9]: IcePick reset event"
|
|
|
+ ;;
|
|
|
+ clear)
|
|
|
+ `devmem 0x44e00f08 w 0xffffffff`
|
|
|
+ echo "CPU reset reason register cleared."
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+fi
|
|
|
+
|