diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-03-02 23:36:19 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-03-02 23:36:19 +0100 |
commit | f7636162ba124c0d6b5accaa72c842033f3e2309 (patch) | |
tree | 9ae5ceddde46e7c511bba899b869f54c6fef6283 /xml | |
parent | 7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79 (diff) | |
parent | 02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3 (diff) | |
download | pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.tar.gz pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.tar.bz2 pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.tar.xz pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.zip |
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
Diffstat (limited to 'xml')
-rw-r--r-- | xml/test/cmosis.xml | 50 | ||||
-rw-r--r-- | xml/test/props.xml | 1 | ||||
-rw-r--r-- | xml/test/test_prop2.py | 3 | ||||
-rw-r--r-- | xml/test/test_prop4.py | 24 |
4 files changed, 26 insertions, 52 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 57702e2..750881d 100644 --- a/xml/test/props.xml +++ b/xml/test/props.xml @@ -3,4 +3,5 @@ <transform path="/test/prop1" register="test_prop1" unit="C" read_from_register="(503975./1024000)*${/registers/fpga/sensor_temperature:C} - 27315./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/prop4" register="test_prop4" unit="C" script="test_prop4.py" description="Example of thread safe python property"/> </model> diff --git a/xml/test/test_prop2.py b/xml/test/test_prop2.py index d78dbea..8a3ebf6 100644 --- a/xml/test/test_prop2.py +++ b/xml/test/test_prop2.py @@ -1,6 +1,5 @@ def read_from_register(ctx, value): return ctx.get_property('/test/prop3') / 2 - + def write_to_register(ctx, value): ctx.set_property(value*2, '/test/prop3') - diff --git a/xml/test/test_prop4.py b/xml/test/test_prop4.py new file mode 100644 index 0000000..a7e0269 --- /dev/null +++ b/xml/test/test_prop4.py @@ -0,0 +1,24 @@ +import time +import threading +lock = threading.Lock() + +def read_from_register(ctx, value): + with lock: + ctx.lock('test_prop4') + + 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('test_prop4') + + return out + +read_from_register.counter = 0 + +def write_to_register(ctx, value): + with lock: + ctx.set_property(value*2, '/test/prop3') |