Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-init
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-init
Commits
009572bc
Commit
009572bc
authored
Nov 25, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Waiting for FPGA programmed before initializing SATA and logger
parent
08f5980c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
init_elphel393.py
src/init_elphel393.py
+39
-0
No files found.
src/init_elphel393.py
View file @
009572bc
...
@@ -50,7 +50,28 @@ SATA_EN = 1
...
@@ -50,7 +50,28 @@ SATA_EN = 1
PYDIR
=
"/usr/local/bin"
PYDIR
=
"/usr/local/bin"
VERILOG_DIR
=
"/usr/local/verilog"
VERILOG_DIR
=
"/usr/local/verilog"
LOGFILE
=
"/var/log/init_elphel393.log"
LOGFILE
=
"/var/log/init_elphel393.log"
FPGA_VERION_FILE
=
'/sys/devices/soc0/elphel393-framepars@0/fpga_version'
TIMEOUT
=
120
#functions
#functions
def
get_fpga
():
with
open
(
FPGA_VERION_FILE
,
'r'
)
as
f
:
try
:
return
f
.
read
()
except
:
return
None
def
fpga_OK
(
timeout
):
ntry
=
0
fpga
=
None
while
not
fpga
and
((
not
timeout
)
or
(
ntry
<
timeout
)):
fpga
=
get_fpga
()
print
(
'.'
,
end
=
''
)
sys
.
stdout
.
flush
()
ntry
+=
1
time
.
sleep
(
1
)
return
fpga
def
colorize
(
string
,
color
,
bold
):
def
colorize
(
string
,
color
,
bold
):
color
=
color
.
upper
()
color
=
color
.
upper
()
attr
=
[]
attr
=
[]
...
@@ -151,6 +172,14 @@ def init_other_eyesis(index):
...
@@ -151,6 +172,14 @@ def init_other_eyesis(index):
def
init_sata
(
sata_en
,
pydir
):
def
init_sata
(
sata_en
,
pydir
):
if
(
sata_en
==
1
):
if
(
sata_en
==
1
):
if
not
get_fpga
():
log_msg
(
"Waiting for the FPGA to be programmed to start SATA"
)
if
not
fpga_OK
(
TIMEOUT
):
print
()
log_msg
(
"Timeout while waiting for the FPGA to be programmed"
)
return
else
:
print
(
" Done"
)
shout
(
pydir
+
"/x393sata.py"
)
shout
(
pydir
+
"/x393sata.py"
)
shout
(
"modprobe ahci_elphel &"
)
shout
(
"modprobe ahci_elphel &"
)
shout
(
"sleep 2"
)
shout
(
"sleep 2"
)
...
@@ -177,6 +206,15 @@ def start_gps_compass():
...
@@ -177,6 +206,15 @@ def start_gps_compass():
"""
"""
Detect GPS and/or compass boards and start them
Detect GPS and/or compass boards and start them
"""
"""
if
not
get_fpga
():
log_msg
(
"Waiting for the FPGA to be programmed to start SATA"
)
if
not
fpga_OK
(
TIMEOUT
):
print
()
log_msg
(
"Timeout while waiting for the FPGA to be programmed"
)
return
else
:
print
(
" Done"
)
shout
(
"start_gps_compass.php"
)
shout
(
"start_gps_compass.php"
)
def
disable_gpio_10389
():
def
disable_gpio_10389
():
...
@@ -345,6 +383,7 @@ if switch['gps']==1:
...
@@ -345,6 +383,7 @@ if switch['gps']==1:
else
:
else
:
log_msg
(
"skip GPS"
)
log_msg
(
"skip GPS"
)
# create directory for camogm pipes, symlink /var/state should already be in rootfs
# create directory for camogm pipes, symlink /var/state should already be in rootfs
if
not
os
.
path
.
exists
(
"/var/volatile/state"
):
if
not
os
.
path
.
exists
(
"/var/volatile/state"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment