Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
x393
Commits
0a729a6a
Commit
0a729a6a
authored
Oct 11, 2015
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added hwmon command
parent
8a8dc145
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
5 deletions
+44
-5
x393_axi_control_status.py
py393/x393_axi_control_status.py
+25
-1
x393_jpeg.py
py393/x393_jpeg.py
+15
-0
x393_mcntrl_membridge.py
py393/x393_mcntrl_membridge.py
+2
-2
x393_sens_cmprs.py
py393/x393_sens_cmprs.py
+2
-2
No files found.
py393/x393_axi_control_status.py
View file @
0a729a6a
...
...
@@ -159,7 +159,31 @@ class X393AxiControlStatus(object):
'refresh_en'
:
self
.
get_refresh_en
(
quiet
),
'sequences_set'
:
self
.
get_sequences_set
(
quiet
)
}
def
hwmon
(
self
):
"""
Read current temperature and supply voltages
"""
HWMON_PATH
=
"/sys/devices/amba.0/f8007100.ps7-xadc/"
FILE
=
"file"
ITEM
=
"item"
UNITS
=
"units"
SCALE
=
"scale"
HWMON_ITEMS
=
[{
FILE
:
"temp"
,
ITEM
:
"Temperature"
,
UNITS
:
"C"
,
SCALE
:
1.0
},
{
FILE
:
"vccaux"
,
ITEM
:
"VCCaux"
,
UNITS
:
"V"
,
SCALE
:
0.001
},
{
FILE
:
"vccint"
,
ITEM
:
"VCCint"
,
UNITS
:
"V"
,
SCALE
:
0.001
},
{
FILE
:
"vccbram"
,
ITEM
:
"VCCbram"
,
UNITS
:
"V"
,
SCALE
:
0.001
}]
print
(
"hwmon:"
)
for
par
in
HWMON_ITEMS
:
with
open
(
HWMON_PATH
+
par
[
FILE
])
as
f
:
d
=
int
(
f
.
read
())
num_digits
=
0
s
=
par
[
SCALE
]
while
s
<
1
:
s
*=
10
num_digits
+=
1
w
=
2
+
num_digits
+
(
0
,
1
)[
num_digits
>
0
]
frmt
=
"
%%12
s =
%%%
d.
%
df
%%
s"
%
(
w
,
num_digits
)
print
(
frmt
%
(
par
[
ITEM
],(
d
*
par
[
SCALE
]),
par
[
UNITS
]))
def
write_control_register
(
self
,
reg_addr
,
data
):
"""
Write 32-bit word to the control register
...
...
py393/x393_jpeg.py
View file @
0a729a6a
...
...
@@ -976,6 +976,21 @@ print_sensor_i2c 0
#r
add hwmon:
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/temp
47
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/temp_max
48
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/temp_min
41
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/v
0
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/vccaux
1808
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/vccbram
967
root@elphel393:/sys/devices/amba.0/f8007100.ps7-xadc# cat /sys/devices/amba.0/f8007100.ps7-xadc/vccint
966
"""
py393/x393_mcntrl_membridge.py
View file @
0a729a6a
...
...
@@ -39,7 +39,7 @@ import x393_mcntrl_buffers
#import verilog_utils
import
x393_mcntrl
MEM_PATH
=
'/sys/devices/elphel393-mem.2/'
BUFFER_A
SS
RESS_NAME
=
'buffer_address'
BUFFER_A
DD
RESS_NAME
=
'buffer_address'
BUFFER_PAGES_NAME
=
'buffer_pages'
BUFFER_ADDRESS
=
None
BUFFER_LEN
=
None
...
...
@@ -113,7 +113,7 @@ class X393McntrlMembridge(object):
print
(
"Running in simulated mode, using hard-coded addresses:"
)
else
:
try
:
with
open
(
MEM_PATH
+
BUFFER_A
SS
RESS_NAME
)
as
sysfile
:
with
open
(
MEM_PATH
+
BUFFER_A
DD
RESS_NAME
)
as
sysfile
:
BUFFER_ADDRESS
=
int
(
sysfile
.
read
(),
0
)
with
open
(
MEM_PATH
+
BUFFER_PAGES_NAME
)
as
sysfile
:
BUFFER_LEN
=
PAGE_SIZE
*
int
(
sysfile
.
read
(),
0
)
...
...
py393/x393_sens_cmprs.py
View file @
0a729a6a
...
...
@@ -55,7 +55,7 @@ PAGE_SIZE = 4096
SI5338_PATH
=
'/sys/devices/amba.0/e0004000.ps7-i2c/i2c-0/0-0070'
POWER393_PATH
=
'/sys/devices/elphel393-pwr.1'
MEM_PATH
=
'/sys/devices/elphel393-mem.2/'
BUFFER_A
SS
RESS_NAME
=
'buffer_address'
BUFFER_A
DD
RESS_NAME
=
'buffer_address'
BUFFER_PAGES_NAME
=
'buffer_pages'
BUFFER_ADDRESS
=
None
# in bytes
BUFFER_LEN
=
None
# in bytes
...
...
@@ -111,7 +111,7 @@ class X393SensCmprs(object):
print
(
"Running in simulated mode, using hard-coded addresses:"
)
else
:
try
:
with
open
(
MEM_PATH
+
BUFFER_A
SS
RESS_NAME
)
as
sysfile
:
with
open
(
MEM_PATH
+
BUFFER_A
DD
RESS_NAME
)
as
sysfile
:
BUFFER_ADDRESS
=
int
(
sysfile
.
read
(),
0
)
with
open
(
MEM_PATH
+
BUFFER_PAGES_NAME
)
as
sysfile
:
BUFFER_LEN
=
PAGE_SIZE
*
int
(
sysfile
.
read
(),
0
)
...
...
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