|
@@ -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
|
|
|
-
|