Loading src/Makefile +8 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,10 @@ MODPROBEDIR=$(SYSCONFDIR)/modprobe.d DRIVER_NAME=ahci_elphel DRIVER_NAME=ahci_elphel CONFDIR=$(SYSCONFDIR)/elphel393 CONFDIR=$(SYSCONFDIR)/elphel393 STATEDIR = $(DESTDIR)/var/volatile/state STATELINK = $(DESTDIR)/var/state LINK = ln OWN = -o root -g root OWN = -o root -g root INSTALL = install INSTALL = install Loading Loading @@ -41,5 +45,9 @@ install: $(INSTALL) $(OWN) -d $(MODPROBEDIR) $(INSTALL) $(OWN) -d $(MODPROBEDIR) echo "blacklist $(DRIVER_NAME)" >> $(MODPROBEDIR)/blacklist.conf echo "blacklist $(DRIVER_NAME)" >> $(MODPROBEDIR)/blacklist.conf # create directories to support legacy scripts $(INSTALL) $(OWN) -d $(STATEDIR) $(LINK) -s -r $(STATEDIR) $(STATELINK) clean: clean: @echo "make clean in src" @echo "make clean in src" src/init_elphel393.py +102 −48 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ __status__ = "Development" import subprocess import subprocess import sys import sys import time #params #params SENSOR_TYPE = 5 SENSOR_TYPE = 5 Loading @@ -47,80 +48,133 @@ PYDIR = "/usr/local/bin" VERILOG_DIR = "/usr/local/verilog" VERILOG_DIR = "/usr/local/verilog" #functions #functions def chout(cmd): def shout(cmd): #subprocess.call prints to console #subprocess.call prints to console subprocess.call(cmd,shell=True) subprocess.call(cmd,shell=True) def init_ipaddr(ip): def init_ipaddr(ip): chout("ifconfig eth0 "+ip) shout("ifconfig eth0 "+ip) def init_mcntrl(pydir,verilogdir): def init_mcntrl(pydir,verilogdir): chout(pydir+"/test_mcntrl.py @"+verilogdir+"/hargs") shout(pydir+"/test_mcntrl.py @"+verilogdir+"/hargs") def init_imgsrv(port): def init_imgsrv(port): chout("imgsrv -p "+str(port)) shout("imgsrv -p "+str(port)) #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail chout("killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf") shout("killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf") chout("/www/pages/exif.php init=/etc/Exif_template.xml") shout("/www/pages/exif.php init=/etc/Exif_template.xml") def init_autoexp_autowb(index,mask): def init_port(index): print("Port "+index+": framepars enable") shout("wget -O /dev/null \"localhost/framepars.php?sensor_port="+index+"&cmd=init\"") if (mask==0x1): def init_autoexp(index): sysfs_content = "" shout("autoexposure -p "+index+" -c 0 -b 0 -d 1 &") # read sysfs, overwrite if argv?! shout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3\"") with open("/sys/devices/soc0/elphel393-detect_sensors@0/sensor"+index+"0", 'r') as content_file: sysfs_content = content_file.read() sysfs_content = sysfs_content.strip() #Sensor list def init_autowb(index): #1. mt9p006 shout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000\"") #2. mt9f002 #3. ... if (sysfs_content=="mt9p006"): print("Port "+index+": enabling auto exposure and auto white balance") chout("wget -O /dev/null \"localhost/framepars.php?sensor_port="+index+"&cmd=init\"") chout("autoexposure -p "+index+" -c 0 -b 0 -d 1 &") chout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3\"") chout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000\"") else: print("Port "+index+": disabled, please check the Device Tree") else: print("Port "+index+": disabled in init_elphel393") def init_sata(sata_en,pydir): def init_sata(sata_en,pydir): if (sata_en==1): if (sata_en==1): chout(pydir+"/x393sata.py") shout(pydir+"/x393sata.py") chout("modprobe ahci_elphel &") shout("modprobe ahci_elphel &") chout("sleep 2") shout("sleep 2") chout("echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module") shout("echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module") #main #main #argv[1] - port mask, overrides device tree records if len(sys.argv) > 1: mask = sys.argv[1] else: mask = 0xf mask = int(str(mask), 16) # default switch = { 'ip':1, 'mcntrl':1, 'imgsrv':1, 'port1':1, 'port2':1, 'port3':1, 'port4':1, 'framepars':1, 'autoexp':1, 'autowb':1, 'sata':1 } # update from argv if len(sys.argv) > 1: switch.update(eval(sys.argv[1])) #1 #1 if switch['ip']==1: print(sys.argv[0]+": ip = "+IPADDR) print(sys.argv[0]+": ip = "+IPADDR) init_ipaddr(IPADDR) init_ipaddr(IPADDR) else: print("skip ip") #2 #2 if switch['mcntrl']==1: print(sys.argv[0]+": mcntrl") print(sys.argv[0]+": mcntrl") init_mcntrl(PYDIR,VERILOG_DIR) init_mcntrl(PYDIR,VERILOG_DIR) else: print("skip mcntrl") #3 #3 if switch['imgsrv']==1: print(sys.argv[0]+": imgsrv") print(sys.argv[0]+": imgsrv") init_imgsrv(IMGSRV_PORT) init_imgsrv(IMGSRV_PORT) else: print("skip imgsrv") #4 #4 print(sys.argv[0]+": autoexposure and auto white balance") print(sys.argv[0]+": init ports") for i in range(4): for i in range(1,5): init_autoexp_autowb(str(i),(mask>>i)&0x1) if switch['port'+str(i)]==1: index = str(i-1) sysfs_content = "" # read sysfs, overwrite if argv?! with open("/sys/devices/soc0/elphel393-detect_sensors@0/sensor"+index+"0", 'r') as content_file: sysfs_content = content_file.read() sysfs_content = sysfs_content.strip() #Sensor list #1. mt9p006 #2. mt9f002 #3. ... if (sysfs_content=="mt9p006"): init_port(index) else: switch['port'+str(i)] = 0 print("Sensor port "+str(i)+": disabled, please check device tree") else: print("skip sensor port "+str(i)) time.sleep(1) #5 #5 print("SATA") print(sys.argv[0]+": auto exposure and auto white balance") for i in range(1,5): if switch['port'+str(i)]==1: index = str(i-1) if switch['autoexp']==1: init_autoexp(index) else: print("Port "+str(i)+": skip autoexp") if switch['autowb']==1: init_autowb(index) else: print("Port "+str(i)+": skip autowb") #6 print(sys.argv[0]+" SATA") if switch['sata']==1: init_sata(SATA_EN,PYDIR) init_sata(SATA_EN,PYDIR) else: print("skip SATA") # create directory for camogm pipes, symlink /var/state should already be in rootfs shout("mkdir /var/volatile/state") # start temperature monitor and let it control fan (set 'off' to disable fan control) shout("tempmon.py --control_fan on") src/init_elphel393.sh +29 −3 Original line number Original line Diff line number Diff line Loading @@ -19,29 +19,55 @@ ifconfig eth0 192.168.0.9 PYDIR=/usr/local/bin PYDIR=/usr/local/bin VERILOG_DIR=/usr/local/verilog VERILOG_DIR=/usr/local/verilog #echo "exiting before power on" #exit 0; #$PYDIR/test_mcntrl.py @${VERILOG_DIR}/hargs-eyesis $PYDIR/test_mcntrl.py @${VERILOG_DIR}/hargs $PYDIR/test_mcntrl.py @${VERILOG_DIR}/hargs echo imgsrv -p 2323 echo imgsrv -p 2323 imgsrv -p 2323 imgsrv -p 2323 #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf /www/pages/exif.php init=/etc/Exif_template.xml /www/pages/exif.php init=/etc/Exif_template.xml #echo "TURN 10359 power in the next 10 seconds" #sleep 10 exit 0 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag0 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag0 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag1 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag1 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag2 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag2 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag3 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag3 wget -O /dev/null "localhost/framepars.php?sensor_port=3&cmd=min_init" exit 0 #wget -O /dev/null "localhost/framepars.php?sensor_port=3&cmd=min_init" #wget -O /dev/null "localhost/framepars.php?sensor_port=2&cmd=min_init" #wget -O /dev/null "localhost/framepars.php?sensor_port=2&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=3&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=2&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=2&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=1&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=0&cmd=min_init" sleep 1 sleep 2 cat /proc/interrupts cat /proc/interrupts #sleep 1 #sleep 1 #cat /proc/interrupts #cat /proc/interrupts autoexposure -p 2 -c 0 -b 0 -d 1 & autoexposure -p 2 -c 0 -b 0 -d 1 & autoexposure -p 3 -c 0 -b 0 -d 1 & autoexposure -p 1 -c 0 -b 0 -d 1 & autoexposure -p 0 -c 0 -b 0 -d 1 & wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=3&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=1&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=0&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=3&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=1&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=0&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" exit 0 exit 0 echo "init sensor port" echo "init sensor port" Loading Loading
src/Makefile +8 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,10 @@ MODPROBEDIR=$(SYSCONFDIR)/modprobe.d DRIVER_NAME=ahci_elphel DRIVER_NAME=ahci_elphel CONFDIR=$(SYSCONFDIR)/elphel393 CONFDIR=$(SYSCONFDIR)/elphel393 STATEDIR = $(DESTDIR)/var/volatile/state STATELINK = $(DESTDIR)/var/state LINK = ln OWN = -o root -g root OWN = -o root -g root INSTALL = install INSTALL = install Loading Loading @@ -41,5 +45,9 @@ install: $(INSTALL) $(OWN) -d $(MODPROBEDIR) $(INSTALL) $(OWN) -d $(MODPROBEDIR) echo "blacklist $(DRIVER_NAME)" >> $(MODPROBEDIR)/blacklist.conf echo "blacklist $(DRIVER_NAME)" >> $(MODPROBEDIR)/blacklist.conf # create directories to support legacy scripts $(INSTALL) $(OWN) -d $(STATEDIR) $(LINK) -s -r $(STATEDIR) $(STATELINK) clean: clean: @echo "make clean in src" @echo "make clean in src"
src/init_elphel393.py +102 −48 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ __status__ = "Development" import subprocess import subprocess import sys import sys import time #params #params SENSOR_TYPE = 5 SENSOR_TYPE = 5 Loading @@ -47,80 +48,133 @@ PYDIR = "/usr/local/bin" VERILOG_DIR = "/usr/local/verilog" VERILOG_DIR = "/usr/local/verilog" #functions #functions def chout(cmd): def shout(cmd): #subprocess.call prints to console #subprocess.call prints to console subprocess.call(cmd,shell=True) subprocess.call(cmd,shell=True) def init_ipaddr(ip): def init_ipaddr(ip): chout("ifconfig eth0 "+ip) shout("ifconfig eth0 "+ip) def init_mcntrl(pydir,verilogdir): def init_mcntrl(pydir,verilogdir): chout(pydir+"/test_mcntrl.py @"+verilogdir+"/hargs") shout(pydir+"/test_mcntrl.py @"+verilogdir+"/hargs") def init_imgsrv(port): def init_imgsrv(port): chout("imgsrv -p "+str(port)) shout("imgsrv -p "+str(port)) #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail chout("killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf") shout("killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf") chout("/www/pages/exif.php init=/etc/Exif_template.xml") shout("/www/pages/exif.php init=/etc/Exif_template.xml") def init_autoexp_autowb(index,mask): def init_port(index): print("Port "+index+": framepars enable") shout("wget -O /dev/null \"localhost/framepars.php?sensor_port="+index+"&cmd=init\"") if (mask==0x1): def init_autoexp(index): sysfs_content = "" shout("autoexposure -p "+index+" -c 0 -b 0 -d 1 &") # read sysfs, overwrite if argv?! shout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3\"") with open("/sys/devices/soc0/elphel393-detect_sensors@0/sensor"+index+"0", 'r') as content_file: sysfs_content = content_file.read() sysfs_content = sysfs_content.strip() #Sensor list def init_autowb(index): #1. mt9p006 shout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000\"") #2. mt9f002 #3. ... if (sysfs_content=="mt9p006"): print("Port "+index+": enabling auto exposure and auto white balance") chout("wget -O /dev/null \"localhost/framepars.php?sensor_port="+index+"&cmd=init\"") chout("autoexposure -p "+index+" -c 0 -b 0 -d 1 &") chout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3\"") chout("wget -O /dev/null \"localhost/parsedit.php?immediate&sensor_port="+index+"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000\"") else: print("Port "+index+": disabled, please check the Device Tree") else: print("Port "+index+": disabled in init_elphel393") def init_sata(sata_en,pydir): def init_sata(sata_en,pydir): if (sata_en==1): if (sata_en==1): chout(pydir+"/x393sata.py") shout(pydir+"/x393sata.py") chout("modprobe ahci_elphel &") shout("modprobe ahci_elphel &") chout("sleep 2") shout("sleep 2") chout("echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module") shout("echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module") #main #main #argv[1] - port mask, overrides device tree records if len(sys.argv) > 1: mask = sys.argv[1] else: mask = 0xf mask = int(str(mask), 16) # default switch = { 'ip':1, 'mcntrl':1, 'imgsrv':1, 'port1':1, 'port2':1, 'port3':1, 'port4':1, 'framepars':1, 'autoexp':1, 'autowb':1, 'sata':1 } # update from argv if len(sys.argv) > 1: switch.update(eval(sys.argv[1])) #1 #1 if switch['ip']==1: print(sys.argv[0]+": ip = "+IPADDR) print(sys.argv[0]+": ip = "+IPADDR) init_ipaddr(IPADDR) init_ipaddr(IPADDR) else: print("skip ip") #2 #2 if switch['mcntrl']==1: print(sys.argv[0]+": mcntrl") print(sys.argv[0]+": mcntrl") init_mcntrl(PYDIR,VERILOG_DIR) init_mcntrl(PYDIR,VERILOG_DIR) else: print("skip mcntrl") #3 #3 if switch['imgsrv']==1: print(sys.argv[0]+": imgsrv") print(sys.argv[0]+": imgsrv") init_imgsrv(IMGSRV_PORT) init_imgsrv(IMGSRV_PORT) else: print("skip imgsrv") #4 #4 print(sys.argv[0]+": autoexposure and auto white balance") print(sys.argv[0]+": init ports") for i in range(4): for i in range(1,5): init_autoexp_autowb(str(i),(mask>>i)&0x1) if switch['port'+str(i)]==1: index = str(i-1) sysfs_content = "" # read sysfs, overwrite if argv?! with open("/sys/devices/soc0/elphel393-detect_sensors@0/sensor"+index+"0", 'r') as content_file: sysfs_content = content_file.read() sysfs_content = sysfs_content.strip() #Sensor list #1. mt9p006 #2. mt9f002 #3. ... if (sysfs_content=="mt9p006"): init_port(index) else: switch['port'+str(i)] = 0 print("Sensor port "+str(i)+": disabled, please check device tree") else: print("skip sensor port "+str(i)) time.sleep(1) #5 #5 print("SATA") print(sys.argv[0]+": auto exposure and auto white balance") for i in range(1,5): if switch['port'+str(i)]==1: index = str(i-1) if switch['autoexp']==1: init_autoexp(index) else: print("Port "+str(i)+": skip autoexp") if switch['autowb']==1: init_autowb(index) else: print("Port "+str(i)+": skip autowb") #6 print(sys.argv[0]+" SATA") if switch['sata']==1: init_sata(SATA_EN,PYDIR) init_sata(SATA_EN,PYDIR) else: print("skip SATA") # create directory for camogm pipes, symlink /var/state should already be in rootfs shout("mkdir /var/volatile/state") # start temperature monitor and let it control fan (set 'off' to disable fan control) shout("tempmon.py --control_fan on")
src/init_elphel393.sh +29 −3 Original line number Original line Diff line number Diff line Loading @@ -19,29 +19,55 @@ ifconfig eth0 192.168.0.9 PYDIR=/usr/local/bin PYDIR=/usr/local/bin VERILOG_DIR=/usr/local/verilog VERILOG_DIR=/usr/local/verilog #echo "exiting before power on" #exit 0; #$PYDIR/test_mcntrl.py @${VERILOG_DIR}/hargs-eyesis $PYDIR/test_mcntrl.py @${VERILOG_DIR}/hargs $PYDIR/test_mcntrl.py @${VERILOG_DIR}/hargs echo imgsrv -p 2323 echo imgsrv -p 2323 imgsrv -p 2323 imgsrv -p 2323 #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail #restart PHP - it can get errors while opening/mmaping at startup, then some functions fail killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf killall lighttpd; /usr/sbin/lighttpd -f /etc/lighttpd.conf /www/pages/exif.php init=/etc/Exif_template.xml /www/pages/exif.php init=/etc/Exif_template.xml #echo "TURN 10359 power in the next 10 seconds" #sleep 10 exit 0 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag0 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag0 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag1 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag1 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag2 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag2 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag3 cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag3 wget -O /dev/null "localhost/framepars.php?sensor_port=3&cmd=min_init" exit 0 #wget -O /dev/null "localhost/framepars.php?sensor_port=3&cmd=min_init" #wget -O /dev/null "localhost/framepars.php?sensor_port=2&cmd=min_init" #wget -O /dev/null "localhost/framepars.php?sensor_port=2&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=3&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=2&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=2&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=1&cmd=min_init" wget -O - "localhost/framepars.php?sensor_port=0&cmd=min_init" sleep 1 sleep 2 cat /proc/interrupts cat /proc/interrupts #sleep 1 #sleep 1 #cat /proc/interrupts #cat /proc/interrupts autoexposure -p 2 -c 0 -b 0 -d 1 & autoexposure -p 2 -c 0 -b 0 -d 1 & autoexposure -p 3 -c 0 -b 0 -d 1 & autoexposure -p 1 -c 0 -b 0 -d 1 & autoexposure -p 0 -c 0 -b 0 -d 1 & wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=3&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=1&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=0&COMPRESSOR_RUN=2&DAEMON_EN=1*12&AUTOEXP_ON=1&AEXP_FRACPIX=0xff80&AEXP_LEVEL=0xf800&AE_PERIOD=4&AE_THRESH=500&HIST_DIM_01=0x0a000a00&HIST_DIM_23=0x0a000a00&EXP_AHEAD=3" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=2&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=3&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=1&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" wget -O /dev/null "localhost/parsedit.php?immediate&sensor_port=0&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x18000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000" exit 0 exit 0 echo "init sensor port" echo "init sensor port" Loading