Browse Source

add set start address

Uros Stevanovic 9 years ago
parent
commit
ac25ab6ed1
1 changed files with 28 additions and 2 deletions
  1. 28 2
      reset.sh

+ 28 - 2
reset.sh

@@ -3,6 +3,7 @@
 PCI=$(which pci)
 NUM_ROWS=1088
 SKIP_ROWS=0
+START_ROW=0
 EXP_TIME=100 #us
 SLEEP_VAL=0.03
 
@@ -79,6 +80,7 @@ function reset_all () {
 
 function check_status () {
     status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'`
+    error=0
     if [ "$status" != "8449ffff0000300100000000" ]; then
         echo -e "\e[31m---------------------->>>> ERROR! in the camera status ...\033[1;m"
         echo $status
@@ -268,9 +270,22 @@ function set_skip () {
 
 }
 
+function set_start_address () {
+    number_lines=$1
+    echo -e "Write start line: \e[93m$number_lines\033[1;m"
+    number_lines=$(printf "%04x\n" $number_lines)
+
+    val=83${number_lines:2:4}
+    write_val $val
+
+    val=84${number_lines:0:2}
+    write_val $val
+}
+
 function print_help () {
     echo -e ""
-    echo "Usage: reset.sh [--dma] [--logic] [--cmosis [--12b]] [--all [--12b]] [--4MP | --num-rows=2047] [--exp-time=100]"
+    echo "Usage: reset.sh [--dma] [--logic] [--cmosis [--12b]] [--all [--12b]]
+                [--4MP | --num-rows=2047] [--exp-time=100] [--skip=0] [--start=0]"
     echo -e "order of options is not important"
     echo -e ""
     echo -e "\e[33m    --help: \033[1;m print this message and exit"
@@ -283,6 +298,7 @@ function print_help () {
     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 "\e[33m    --skip: \033[1;m set skip, default 0"
+    echo -e "\e[33m   --start: \033[1;m set start line, default 0"
     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"
@@ -336,6 +352,11 @@ for i in "$@"; do
             SET_EXP_TIME=YES
             shift
             ;;
+        --start-row=*)
+            START_ROW="${i#*=}"
+            SET_START=YES
+            shift
+            ;;
         --skip=*)
             SKIP_ROWS="${i#*=}"
             SET_SKIP=YES
@@ -350,7 +371,8 @@ 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 [--12b]] [--all [--12b]]
+                [--4MP | --num-rows=2047] [--exp-time=100] [--skip=0] [--start=0]"
   exit 0
 fi
 
@@ -424,6 +446,10 @@ if [ -z "$WRONG" ]; then
         set_skip $SKIP_ROWS
     fi
 
+    if [ "$SET_START" ]; then
+        set_start_address $START_ROW
+    fi
+
     if [ "$SET_EXP_TIME" ]; then
         set_exp_time $EXP_TIME
     fi