Commit dbcd2148 authored by Andrey Filippov's avatar Andrey Filippov

merged with master

parents 0b0ba88c f748e407
...@@ -4,6 +4,10 @@ MODPROBEDIR=$(SYSCONFDIR)/modprobe.d ...@@ -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
...@@ -41,5 +45,9 @@ install: ...@@ -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"
...@@ -34,6 +34,7 @@ __status__ = "Development" ...@@ -34,6 +34,7 @@ __status__ = "Development"
import subprocess import subprocess
import sys import sys
import time
#params #params
SENSOR_TYPE = 5 SENSOR_TYPE = 5
...@@ -47,25 +48,89 @@ PYDIR = "/usr/local/bin" ...@@ -47,25 +48,89 @@ 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):
shout("autoexposure -p "+index+" -c 0 -b 0 -d 1 &")
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\"")
def init_autowb(index):
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\"")
def init_sata(sata_en,pydir):
if (sata_en==1):
shout(pydir+"/x393sata.py")
shout("modprobe ahci_elphel &")
shout("sleep 2")
shout("echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module")
#main
# 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
if switch['ip']==1:
print(sys.argv[0]+": ip = "+IPADDR)
init_ipaddr(IPADDR)
else:
print("skip ip")
#2
if switch['mcntrl']==1:
print(sys.argv[0]+": mcntrl")
init_mcntrl(PYDIR,VERILOG_DIR)
else:
print("skip mcntrl")
#3
if switch['imgsrv']==1:
print(sys.argv[0]+": imgsrv")
init_imgsrv(IMGSRV_PORT)
else:
print("skip imgsrv")
#4
print(sys.argv[0]+": init ports")
for i in range(1,5):
if switch['port'+str(i)]==1:
index = str(i-1)
sysfs_content = "" sysfs_content = ""
# read sysfs, overwrite if argv?! # read sysfs, overwrite if argv?!
with open("/sys/devices/soc0/elphel393-detect_sensors@0/sensor"+index+"0", 'r') as content_file: with open("/sys/devices/soc0/elphel393-detect_sensors@0/sensor"+index+"0", 'r') as content_file:
...@@ -77,50 +142,39 @@ def init_autoexp_autowb(index,mask): ...@@ -77,50 +142,39 @@ def init_autoexp_autowb(index,mask):
#2. mt9f002 #2. mt9f002
#3. ... #3. ...
if (sysfs_content=="mt9p006"): if (sysfs_content=="mt9p006"):
print("Port "+index+": enabling auto exposure and auto white balance") init_port(index)
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: else:
print("Port "+index+": disabled, please check the Device Tree") switch['port'+str(i)] = 0
print("Sensor port "+str(i)+": disabled, please check device tree")
else: else:
print("Port "+index+": disabled in init_elphel393") print("skip sensor port "+str(i))
def init_sata(sata_en,pydir):
if (sata_en==1):
chout(pydir+"/x393sata.py")
chout("modprobe ahci_elphel &")
chout("sleep 2")
chout("echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module")
time.sleep(1)
#5
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")
#main #6
#argv[1] - port mask, overrides device tree records print(sys.argv[0]+" SATA")
if len(sys.argv) > 1: if switch['sata']==1:
mask = sys.argv[1] init_sata(SATA_EN,PYDIR)
else: else:
mask = 0xf print("skip SATA")
mask = int(str(mask), 16) # create directory for camogm pipes, symlink /var/state should already be in rootfs
shout("mkdir /var/volatile/state")
#1 # start temperature monitor and let it control fan (set 'off' to disable fan control)
print(sys.argv[0]+": ip = "+IPADDR) shout("tempmon.py --control_fan on")
init_ipaddr(IPADDR)
#2
print(sys.argv[0]+": mcntrl")
init_mcntrl(PYDIR,VERILOG_DIR)
#3
print(sys.argv[0]+": imgsrv")
init_imgsrv(IMGSRV_PORT)
#4
print(sys.argv[0]+": autoexposure and auto white balance")
for i in range(4):
init_autoexp_autowb(str(i),(mask>>i)&0x1)
#5
print("SATA")
init_sata(SATA_EN,PYDIR)
...@@ -19,29 +19,55 @@ ifconfig eth0 192.168.0.9 ...@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment