Browse Source

Remove out-commented code

Matthias Vogelgesang 9 years ago
parent
commit
15957e0b50
2 changed files with 51 additions and 58 deletions
  1. 4 9
      instead_of_reboot.sh
  2. 47 49
      reset.sh

+ 4 - 9
instead_of_reboot.sh

@@ -2,15 +2,13 @@
 
 device=`lspci -vv | grep -m 1 Xilinx | awk '{print $1}'`
 if [ -z "$device" ]; then
-  echo "Xilinx device doesn't exist, rescanning..."
-  echo 1 > /sys/bus/pci/rescan
-  exit
+    echo "Xilinx device doesn't exist, rescanning..."
+    echo 1 > /sys/bus/pci/rescan
+    exit
 else
-  echo "Xilin is located at: " $device
+    echo "Xilin is located at: " $device
 fi
 echo "remove devices"
-# echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove
-# echo 1 > /sys/bus/pci/devices/0000\:04\:00.0/remove
 echo  1 > /sys/bus/pci/devices/0000\:${device:0:2}\:${device:3:4}/remove
 sleep 1
 echo "rescan"
@@ -21,16 +19,13 @@ rmmod pciDriver
 sleep 1
 echo "instantiate driver"
 modprobe pciDriver
-# insmod /home/lorenzo/pcie/pcitool/driver/pciDriver.ko
 sleep 1
 # for devices with different ID
 echo "10ee 6028" > /sys/bus/pci/drivers/pciDriver/new_id
-# echo "10ee 6024" > /sys/bus/pci/drivers/pciDriver/new_id
 pci -i
 sleep .1
 pci -r 9000
 echo "set bus master dma"
-# dev=04:00.0  
 dev=$device  
 echo Enabling bus mastering on device $dev
 setpci -s $dev 4.w=0x07

+ 47 - 49
reset.sh

@@ -16,9 +16,8 @@ function reset_dma () {
     sleep .1
     pci --start-dma dma0r
     sleep .1
-    #check that all of the buffers are on the x1000 addresses
-    #only 4096B buffers should be 4K alligned
-    # local VAR=`cat /sys/class/fpga/fpga0/kbuf* | grep bus | cut -c 16- | grep -v 000`
+    # check that all of the buffers are on the x1000 addresses
+    # only 4096B buffers should be 4K alligned
     local VAR=`cat /sys/class/fpga/fpga0/kbuffers | awk '{print $1 $2 $3}'`
     VAR=`printf "%s\n" $VAR | grep 4096 | grep -v 000`
     local i=0
@@ -170,10 +169,10 @@ function configure_cmosis () {
     ## register 112, ADC resolution, 0-10bit per pixel, 1-11bit per pixel, 2-12bit per pixel
     if [ "$MODE12b" ]; then
         echo -e "\e[93m12\033[1;m bit mode, set ADC resolution \e[93m12\033[1;m bits "
-        write_val f002 
+        write_val f002
     else
         echo -e "\e[93m10\033[1;m bit mode, set ADC resolution \e[93m10\033[1;m bits "
-        write_val f000  
+        write_val f000
     fi
 
     # adc recommended 28=44
@@ -239,7 +238,7 @@ function configure_cmosis () {
 
 function set_number_lines () {
     number_lines=$1
-    echo -e "Write number of lines: \e[93m$number_lines\033[1;m" 
+    echo -e "Write number of lines: \e[93m$number_lines\033[1;m"
     number_lines=$(printf "%04x\n" $number_lines)
 
     val=81${number_lines:2:4}
@@ -250,30 +249,31 @@ function set_number_lines () {
 }
 
 function print_help () {
-echo -e ""
-echo "Usage: reset.sh [--dma] [--logic] [--cmosis [--12b]] [--all [--12b]] [--4MP | --num-rows=2047] [--exp-time=100]"
-echo -e "order of options is not important"
-echo -e ""
-echo -e "\e[33m    --help: \033[1;m print this message and exit"
-echo -e "\e[33m     --dma: \033[1;m reset only dma"
-echo -e "\e[33m   --logic: \033[1;m reset only logic"
-echo -e "\e[33m  --cmosis: \033[1;m reset cmosis, and set default cmosis values"
-echo -e "\e[33m     --all: \033[1;m reset logic and cmosis, and set default cmosis values"
-echo -e "\e[33m     --4MP: \033[1;m set 2047 rows, default 1088 rows"
-echo -e "\e[33m     --12b: \033[1;m use 12bits, default 10 bits, only use with --cmosis or --all flag"
-echo -e "\e[33m--num-rows: \033[1;m set number of rows, default 1088"
-echo -e "\e[33m--exp-time: \033[1;m set exposure time in us, default 100"
-echo -e "\nExample:"
-echo -e "reset.sh --cmosis            ; --> Reset CMOSIS in 10bit mode"
-echo -e "reset.sh --cmosis --12b --4MP; --> Reset CMOSIS in 12bit mode, 2047 rows"
-echo -e "\nWrong:"
-echo -e "reset.sh --12b                  "
-echo -e "reset.sh --4MP --num-rows=1000  "
-echo -e "\nDiscouraged:"
-echo -e "reset.sh --all --dma --logic --cmosis  "
-
+    echo -e ""
+    echo "Usage: reset.sh [--dma] [--logic] [--cmosis [--12b]] [--all [--12b]] [--4MP | --num-rows=2047] [--exp-time=100]"
+    echo -e "order of options is not important"
+    echo -e ""
+    echo -e "\e[33m    --help: \033[1;m print this message and exit"
+    echo -e "\e[33m     --dma: \033[1;m reset only dma"
+    echo -e "\e[33m   --logic: \033[1;m reset only logic"
+    echo -e "\e[33m  --cmosis: \033[1;m reset cmosis, and set default cmosis values"
+    echo -e "\e[33m     --all: \033[1;m reset logic and cmosis, and set default cmosis values"
+    echo -e "\e[33m     --4MP: \033[1;m set 2047 rows, default 1088 rows"
+    echo -e "\e[33m     --12b: \033[1;m use 12bits, default 10 bits, only use with --cmosis or --all flag"
+    echo -e "\e[33m--num-rows: \033[1;m set number of rows, default 1088"
+    echo -e "\e[33m--exp-time: \033[1;m set exposure time in us, default 100"
+    echo -e "\nExample:"
+    echo -e "reset.sh --cmosis            ; --> Reset CMOSIS in 10bit mode"
+    echo -e "reset.sh --cmosis --12b --4MP; --> Reset CMOSIS in 12bit mode, 2047 rows"
+    echo -e "\nWrong:"
+    echo -e "reset.sh --12b                  "
+    echo -e "reset.sh --4MP --num-rows=1000  "
+    echo -e "\nDiscouraged:"
+    echo -e "reset.sh --all --dma --logic --cmosis  "
 }
+
 input=$@
+
 for i in "$@"; do
     case $i in
         --all)
@@ -306,7 +306,6 @@ for i in "$@"; do
             shift
             ;;
         --num-rows=*)
-            # ROW_SET=YES
             NUM_ROWS="${i#*=}"
             SET_ROWS=YES
             shift
@@ -326,7 +325,6 @@ done
 # check wrong or empty inputs #######################
 if [ -z "$input" ]; then
   echo "Usage: reset.sh [--dma] [--logic] [--cmosis [--12b]] [--all [--12b]] [--4MP | --num-rows=2047] [--exp-time=100]"
-  # echo "Usage: reset.sh [--dma] [--logic] [--cmosis] [--all [--4MP | --num-rows=2047]]"
   exit 0
 fi
 
@@ -334,33 +332,34 @@ if [ "$SHOW_USAGE" ]; then
     print_help
     exit 0
 fi
+
 if [ "$SET_4MP" ] && [ "$SET_ROWS" ]; then
-  WRONG=YES
+    WRONG=YES
 fi
 
 if [ -z "$RESET_CMOSIS" ]; then
-  if [ -z "$RESET_ALL" ]; then
-    if [ "$MODE12b" ]; then
-      WRONG=YES
-    elif [ "$SET_4MP" ] && [ "$SET_ROWS" ]; then
-      WRONG=YES
-    elif [ "$SET_4MP" ]; then
-      set_number_lines $NUM_ROWS
-    elif [ "$SET_ROWS" ]; then
-      set_number_lines $NUM_ROWS
-    elif [ "$SET_EXP_TIME" ]; then
-      set_exp_time $EXP_TIME
+    if [ -z "$RESET_ALL" ]; then
+        if [ "$MODE12b" ]; then
+            WRONG=YES
+        elif [ "$SET_4MP" ] && [ "$SET_ROWS" ]; then
+            WRONG=YES
+        elif [ "$SET_4MP" ]; then
+            set_number_lines $NUM_ROWS
+        elif [ "$SET_ROWS" ]; then
+            set_number_lines $NUM_ROWS
+        elif [ "$SET_EXP_TIME" ]; then
+            set_exp_time $EXP_TIME
+        fi
     fi
-  fi
 fi
 
 if [ "$WRONG" ]; then
-  echo -e ""
-  echo -e "\e[101m  !!!WRONG ARGUMENT!!!, check reset.sh --help \033[1;m"
-  echo -e ""
-  exit
+    echo -e ""
+    echo -e "\e[101m  !!!WRONG ARGUMENT!!!, check reset.sh --help \033[1;m"
+    echo -e ""
+    exit
 fi
-#################################################
+
 if [ "$RESET_DMA" ]; then
     reset_dma
 fi
@@ -390,4 +389,3 @@ if [ "$RESET_ALL" ]; then
     set_exp_time $EXP_TIME
     check_status
 fi
-