diff options
Diffstat (limited to 'xml')
-rw-r--r-- | xml/CMakeLists.txt | 27 | ||||
-rw-r--r-- | xml/model.xsd | 1 | ||||
-rw-r--r-- | xml/references.xsd | 1 | ||||
-rw-r--r-- | xml/test2/reg2.py | 0 | ||||
-rw-r--r-- | xml/test_pywrap/camera.xml (renamed from xml/test2/camera.xml) | 0 | ||||
-rw-r--r-- | xml/test_pywrap/names.xml (renamed from xml/test2/names.xml) | 0 | ||||
-rw-r--r-- | xml/test_pywrap/props.xml (renamed from xml/test2/props.xml) | 10 | ||||
-rw-r--r-- | xml/test_pywrap/test_prop2.py | 7 | ||||
-rw-r--r-- | xml/test_pywrap/test_prop3.py | 4 | ||||
-rw-r--r-- | xml/test_pywrap/units.xml (renamed from xml/test2/units.xml) | 0 | ||||
-rw-r--r-- | xml/test_pywrap/views.xml (renamed from xml/test2/views.xml) | 0 | ||||
-rw-r--r-- | xml/types.xsd | 11 |
12 files changed, 61 insertions, 0 deletions
diff --git a/xml/CMakeLists.txt b/xml/CMakeLists.txt index a7ac800..0b12d87 100644 --- a/xml/CMakeLists.txt +++ b/xml/CMakeLists.txt @@ -1,3 +1,30 @@ install(FILES model.xsd references.xsd types.xsd DESTINATION ${PCILIB_MODEL_DIR} ) + +# Copy files from source directory to destination directory, substituting any +# variables. Create destination directory if it does not exist. + +macro(configure_files srcDir destDir) + message(STATUS "Configuring directory ${destDir}") + make_directory(${destDir}) + + file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*) + foreach(templateFile ${templateFiles}) + set(srcTemplatePath ${srcDir}/${templateFile}) + if(NOT IS_DIRECTORY ${srcTemplatePath}) + message(STATUS "Configuring file ${templateFile}") + configure_file( + ${srcTemplatePath} + ${destDir}/${templateFile} + @ONLY) + endif(NOT IS_DIRECTORY ${srcTemplatePath}) + endforeach(templateFile) +endmacro(configure_files) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/model.xsd ${CMAKE_CURRENT_BINARY_DIR}/model.xsd) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/references.xsd ${CMAKE_CURRENT_BINARY_DIR}/references.xsd) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/types.xsd ${CMAKE_CURRENT_BINARY_DIR}/types.xsd) + +configure_files(${CMAKE_CURRENT_SOURCE_DIR}/test ${CMAKE_CURRENT_BINARY_DIR}/test) +configure_files(${CMAKE_CURRENT_SOURCE_DIR}/test_pywrap ${CMAKE_CURRENT_BINARY_DIR}/test_pywrap) diff --git a/xml/model.xsd b/xml/model.xsd index 164e887..f6f5ea3 100644 --- a/xml/model.xsd +++ b/xml/model.xsd @@ -7,6 +7,7 @@ <xsd:choice minOccurs="1" maxOccurs="unbounded"> <xsd:element name="bank" type="pcilib_bank_t" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="transform" type="pcilib_transform_view_t" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="script" type="pcilib_script_view_t" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="enum" type="pcilib_enum_view_t" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="unit" type="pcilib_unit_t" minOccurs="0" maxOccurs="unbounded" /> </xsd:choice> diff --git a/xml/references.xsd b/xml/references.xsd index 4474141..523daa2 100644 --- a/xml/references.xsd +++ b/xml/references.xsd @@ -6,6 +6,7 @@ <xsd:choice minOccurs="1" maxOccurs="unbounded"> <xsd:element name="bank" type="pcilib_bank_t" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="transform" type="pcilib_transform_view_t" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="script" type="pcilib_script_view_t" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="enum" type="pcilib_enum_view_t" minOccurs="0" maxOccurs="unbounded"> <xsd:key name="pcilib_value_name_key"> <xsd:selector xpath="name" /> diff --git a/xml/test2/reg2.py b/xml/test2/reg2.py deleted file mode 100644 index e69de29..0000000 --- a/xml/test2/reg2.py +++ /dev/null diff --git a/xml/test2/camera.xml b/xml/test_pywrap/camera.xml index 4b31209..4b31209 100644 --- a/xml/test2/camera.xml +++ b/xml/test_pywrap/camera.xml diff --git a/xml/test2/names.xml b/xml/test_pywrap/names.xml index f6ddbcc..f6ddbcc 100644 --- a/xml/test2/names.xml +++ b/xml/test_pywrap/names.xml diff --git a/xml/test2/props.xml b/xml/test_pywrap/props.xml index f7a1329..137ad04 100644 --- a/xml/test2/props.xml +++ b/xml/test_pywrap/props.xml @@ -1,4 +1,14 @@ <?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)*${/registers/fpga/reg1} + 28715./100" description="formula to get real fpga temperature from the fpga_temperature register in decimal"/> + <script path="/test/prop2" + register="test_prop2" + unit="C" + script="test_prop2.py" + description="test python script #1"/> + <script path="/test/prop3" + register="test_prop3" + unit="C" + script="test_prop3.py" + description="test python script #2"/> </model> diff --git a/xml/test_pywrap/test_prop2.py b/xml/test_pywrap/test_prop2.py new file mode 100644 index 0000000..e9a3364 --- /dev/null +++ b/xml/test_pywrap/test_prop2.py @@ -0,0 +1,7 @@ +import pcipywrap +import os + +def read_from_register(): + reg1_val = pcipywrap.read_register('reg1'); + test_prop1_val = pcipywrap.read_register('test_prop3'); + return test_prop1_val - reg1_val; diff --git a/xml/test_pywrap/test_prop3.py b/xml/test_pywrap/test_prop3.py new file mode 100644 index 0000000..c1300b3 --- /dev/null +++ b/xml/test_pywrap/test_prop3.py @@ -0,0 +1,4 @@ +import os + +def read_from_register(): + return 10; diff --git a/xml/test2/units.xml b/xml/test_pywrap/units.xml index 74ab9f7..74ab9f7 100644 --- a/xml/test2/units.xml +++ b/xml/test_pywrap/units.xml diff --git a/xml/test2/views.xml b/xml/test_pywrap/views.xml index c40cd0f..c40cd0f 100644 --- a/xml/test2/views.xml +++ b/xml/test_pywrap/views.xml diff --git a/xml/types.xsd b/xml/types.xsd index 78be773..239df8d 100644 --- a/xml/types.xsd +++ b/xml/types.xsd @@ -74,6 +74,17 @@ </xsd:extension> </xsd:complexContent> </xsd:complexType> + + <xsd:complexType name="pcilib_script_view_t"> + <xsd:complexContent> + <xsd:extension base="pcilib_view_t"> + <xsd:attribute name="path" type="xsd:string" /> + <xsd:attribute name="register" type="xsd:string" /> + <xsd:attribute name="script" type="xsd:string" /> + <!-- xsd 1.1 <xsd:assert test="(@path and not(@name)) or (not(@path) and @name)"/> --> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> <xsd:complexType name="pcilib_enum_view_t"> <xsd:complexContent> |