summaryrefslogtreecommitdiffstats
path: root/xml
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-02-26 10:19:58 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-02-26 10:19:58 +0100
commite2550e6df11558ccd6e8b95f489c0988b34347af (patch)
tree7f959bbfe4a332b83e77f939a7c308d21e62b747 /xml
parent3bf5383a7ea03c5aa263aa4d8acf8b4949547319 (diff)
downloadpcitool-e2550e6df11558ccd6e8b95f489c0988b34347af.tar.gz
pcitool-e2550e6df11558ccd6e8b95f489c0988b34347af.tar.bz2
pcitool-e2550e6df11558ccd6e8b95f489c0988b34347af.tar.xz
pcitool-e2550e6df11558ccd6e8b95f489c0988b34347af.zip
1. pywrap:
- fix get_registers_list crash with bank != NULL - set correct python version in cmake install step 2. html_server: - merge set and get value boxes into one box - add registers bank view mode - read registers/properties values in bank/branch view mode 3. xml/test - remove cmosis registers - add multithread safe property example
Diffstat (limited to 'xml')
-rw-r--r--xml/test/cmosis.xml50
-rw-r--r--xml/test/props.xml7
-rw-r--r--xml/test/test_prop_mt.py24
3 files changed, 30 insertions, 51 deletions
diff --git a/xml/test/cmosis.xml b/xml/test/cmosis.xml
deleted file mode 100644
index 45d2f6e..0000000
--- a/xml/test/cmosis.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <bank bar="0" size="128" protocol="software_registers" read_address="0x9010" write_address="0x9000" word_size="8" endianess="little" format="%lu" name="cmosis" description="CMOSIS CMV2000 Registers">
- <register address="1" offset="0" size="16" default="1088" rwmask="0" mode="RW" name="cmosis_number_lines" description="test"/>
- <register address="3" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start1"/>
- <register address="5" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start2"/>
- <register address="7" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start3"/>
- <register address="9" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start4"/>
- <register address="11" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start5"/>
- <register address="13" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start6"/>
- <register address="15" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start7"/>
- <register address="17" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_start8"/>
- <register address="19" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines1"/>
- <register address="21" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines2"/>
- <register address="23" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines3"/>
- <register address="25" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines4"/>
- <register address="27" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines5"/>
- <register address="29" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines6"/>
- <register address="31" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines7"/>
- <register address="33" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_number_lines8"/>
- <register address="35" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_sub_s"/>
- <register address="37" offset="0" size="16" default="0" rwmask="0" mode="RW" name="cmosis_sub_a"/>
- <register address="39" offset="0" size="1" default="1" rwmask="0" mode="RW" name="cmosis_color"/>
- <register address="40" offset="0" size="2" default="0" rwmask="0" mode="RW" name="cmosis_image_flipping"/>
- <register address="41" offset="0" size="2" default="0" rwmask="0" mode="RW" name="cmosis_exp_flags"/>
- <register address="42" offset="0" size="24" default="1088" rwmask="0" mode="RW" name="cmosis_exp_time"><view view="formuu3"/><view view="enumm3"/></register>
- <register address="45" offset="0" size="24" default="1088" rwmask="0" mode="RW" name="cmosis_exp_step"/>
- <register address="48" offset="0" size="24" default="1" rwmask="0" mode="RW" name="cmosis_exp_kp1"/>
- <register address="51" offset="0" size="24" default="1" rwmask="0" mode="RW" name="cmosis_exp_kp2"/>
- <register address="54" offset="0" size="2" default="1" rwmask="0" mode="RW" name="cmosis_nr_slopes"/>
- <register address="55" offset="0" size="8" default="1" rwmask="0" mode="RW" name="cmosis_exp_seq"/>
- <register address="56" offset="0" size="24" default="1088" rwmask="0" mode="RW" name="cmosis_exp_time2"/>
- <register address="59" offset="0" size="24" default="1088" rwmask="0" mode="RW" name="cmosis_exp_step2"/>
- <register address="68" offset="0" size="2" default="1" rwmask="0" mode="RW" name="cmosis_nr_slopes2"/>
- <register address="69" offset="0" size="8" default="1" rwmask="0" mode="RW" name="cmosis_exp_seq2"/>
- <register address="70" offset="0" size="16" default="1" rwmask="0" mode="RW" name="cmosis_number_frames"/>
- <register address="72" offset="0" size="2" default="0" rwmask="0" mode="RW" name="cmosis_output_mode"/>
- <register address="78" offset="0" size="12" default="85" rwmask="0" mode="RW" name="cmosis_training_pattern"/>
- <register address="80" offset="0" size="18" default="0x3FFFF" rwmask="0" mode="RW" name="cmosis_channel_en"/>
- <register address="82" offset="0" size="3" default="7" rwmask="0" mode="RW" name="cmosis_special_82"/>
- <register address="89" offset="0" size="8" default="96" rwmask="0" mode="RW" name="cmosis_vlow2"/>
- <register address="90" offset="0" size="8" default="96" rwmask="0" mode="RW" name="cmosis_vlow3"/>
- <register address="100" offset="0" size="14" default="16260" rwmask="0" mode="RW" name="cmosis_offset"/>
- <register address="102" offset="0" size="2" default="0" rwmask="0" mode="RW" name="cmosis_pga"/>
- <register address="103" offset="0" size="8" default="32" rwmask="0" mode="RW" name="cmosis_adc_gain"/>
- <register address="111" offset="0" size="1" default="1" rwmask="0" mode="RW" name="cmosis_bit_mode"/>
- <register address="112" offset="0" size="2" default="0" rwmask="0" mode="RW" name="cmosis_adc_resolution"/>
- <register address="115" offset="0" size="1" default="1" rwmask="0" mode="RW" name="cmosis_special_115"/>
- </bank>
-</model>
diff --git a/xml/test/props.xml b/xml/test/props.xml
index 650c781..2310d78 100644
--- a/xml/test/props.xml
+++ b/xml/test/props.xml
@@ -1,6 +1,11 @@
<?xml version="1.0"?>
<model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <transform path="/test/prop1" register="test_prop1" unit="C" read_from_register="(503975./1024000) - 27315./100" description="formula to get real fpga temperature from the fpga_temperature register in decimal"/>
+ <transform path="/test/prop1" register="test_prop1" unit="C" read_from_register="(503975./1024000)*${/registers/fpga/fpga_temperature} + 28715./100" description="formula to get real fpga temperature from the fpga_temperature register in decimal"/>
<transform path="/test/prop2" register="test_prop2" unit="C" script="test_prop2.py" description="test python script #1" write_verification="0" />
<transform path="/test/prop3" register="test_prop3" unit="C" script="test_prop3.py" description="test python script #2" />
+ <transform path="/test/prop_mt"
+ register="test_prop_mt"
+ unit="C"
+ script="test_prop_mt.py"
+ description="Example of thread safe python property"/>
</model>
diff --git a/xml/test/test_prop_mt.py b/xml/test/test_prop_mt.py
new file mode 100644
index 0000000..f8c63d0
--- /dev/null
+++ b/xml/test/test_prop_mt.py
@@ -0,0 +1,24 @@
+import time
+import threading
+lock = threading.Lock()
+
+def read_from_register(ctx, value):
+ with lock:
+ ctx.lock('lock5')
+
+ cur = read_from_register.counter
+ read_from_register.counter += 1
+ for i in range (0, 5):
+ time.sleep(0.1)
+ print cur
+ out = ctx.get_property('/test/prop3') / 2
+ ctx.unlock('lock5')
+
+ return out
+
+
+read_from_register.counter = 0
+
+def write_to_register(ctx, value):
+ with lock:
+ ctx.set_property(value*2, '/test/prop3')