#!/bin/sh



dump_reg() {
	# disp
	cat /proc/mi_modules/mi_disp/debug_hal/cfg >> $1
	cat /proc/mi_modules/mi_disp/debug_hal/clk >> $1
	cat /proc/mi_modules/mi_disp/debug_hal/dbgmg >> $1
	cat /proc/mi_modules/mi_disp/debug_hal/func >> $1
	cat /proc/mi_modules/mi_disp/debug_hal/ints >> $1
	/customer/riu_r 101e >> $1
	/customer/riu_r 1037 >> $1
	/customer/riu_r 1038 >> $1
	/customer/riu_r 103c >> $1
	/customer/riu_r 103e >> $1
	/customer/riu_r 1133 >> $1
	/customer/riu_r 1137 >> $1
	/customer/riu_r 1150 >> $1
	/customer/riu_r 1151 >> $1
	/customer/riu_r 1152 >> $1
	/customer/riu_r 1153 >> $1
	/customer/riu_r 1154 >> $1
	/customer/riu_r 1156 >> $1
	/customer/riu_r 1170 >> $1
	/customer/riu_r 1171 >> $1
	/customer/riu_r 1175 >> $1
	/customer/riux32_r 1534 >> $1
	/customer/riux32_r 1535 >> $1
}

auto_run_log_file=$1
dump_count=$2
if [ -z $auto_run_log_file ];then
	echo "Please run with log file name!"
	echo "./pcupid_mhal_disp_reg.sh [log file] [count]"
	exit 1
fi

if [ -z $dump_count ];then
	echo "Please run with dump count!"
	echo "./pcupid_mhal_disp_reg.sh [log file] [count]"
	exit 1
fi

if [ -e $auto_run_log_file ];then
	rm -f $auto_run_log_file
fi

count=0
until [ $count -ge $dump_count ]
do
	echo "dump count:$count"
	echo "dump count:$count" >> $auto_run_log_file
	dump_reg $auto_run_log_file
	let count++
done

echo "Dump success!"
