<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:complexType name="ParameterType" abstract="true">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
                <xs:attribute name="ValueSpace" use="optional">
                    <xs:simpleType name="ValueSpaceEnum">
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="Raw"/>
                            <xs:enumeration value="Real"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="BooleanParameterType">
        <xs:simpleContent>
            <xs:restriction base="ParameterType">
                <xs:pattern value="([01][\s]*)+"/>
                <xs:pattern value="((0x0|0x1)[\s]*)+"/>
                <xs:attribute name="ValueSpace" use="prohibited"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="IntegerParameterType">
        <xs:simpleContent>
            <xs:restriction base="ParameterType">
                <xs:pattern value="(0|([+-]?[1-9][0-9]*))(\s+(0|([+-]?[1-9][0-9]*)))*"/>
                <xs:pattern value="(0x[0-9a-fA-F]+)(\s+(0x[0-9a-fA-F]+))*"/>
                <xs:attribute name="ValueSpace" use="prohibited"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="EnumParameterType">
        <xs:simpleContent>
            <xs:restriction base="ParameterType">
                <xs:attribute name="ValueSpace" use="prohibited"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="PointParameterType">
        <xs:simpleContent>
            <xs:restriction base="ParameterType">
                <xs:pattern value="((0|[+-]?0\.[0-9]+|(([+-]?[1-9][0-9]*)(\.[0-9]+)?))([Ee][+-]?[0-9]+)?)(\s+(0|[+-]?0\.[0-9]+|(([+-]?[1-9][0-9]*)(\.[0-9]+)?))([Ee][+-]?[0-9]+)?)*"/>
                <xs:pattern value="(0x[0-9a-fA-F]+)(\s+(0x[0-9a-fA-F]+))*"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="BitParameterBlockType">
        <xs:sequence>
            <xs:element name="BitParameter" maxOccurs="unbounded" type="IntegerParameterType"/>
        </xs:sequence>
        <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
    </xs:complexType>
    <xs:complexType name="StringParameterType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:group name="ParameterBlockGroup">
        <xs:choice>
            <xs:element name="BooleanParameter" type="BooleanParameterType"/>
            <xs:element name="IntegerParameter" type="IntegerParameterType"/>
            <xs:element name="EnumParameter" type="EnumParameterType"/>
            <xs:element name="FixedPointParameter" type="PointParameterType"/>
            <xs:element name="FloatingPointParameter" type="PointParameterType"/>
            <xs:element name="BitParameterBlock" type="BitParameterBlockType">
                <xs:unique name="BitParameterBlockSubElementsUniqueness">
                    <xs:selector xpath="*"/>
                    <xs:field xpath="@Name"/>
                </xs:unique>
            </xs:element>
            <xs:element name="StringParameter" type="StringParameterType"/>
            <xs:element name="Component" type="ParameterBlockType"/>
            <xs:element name="ParameterBlock" type="ParameterBlockType">
                <xs:unique name="ParameterBlockSubElementsUniqueness">
                    <xs:selector xpath="*"/>
                    <xs:field xpath="@Name"/>
                </xs:unique>
            </xs:element>
        </xs:choice>
    </xs:group>
    <xs:complexType name="ParameterBlockType">
        <xs:sequence>
            <xs:group ref="ParameterBlockGroup" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
    </xs:complexType>
</xs:schema>
