<?xml version="1.0" encoding="UTF-8"?>
<!--
 
  Copyright (c) 2013-2020 ARM Limited. All rights reserved.
 
  SPDX-License-Identifier: Apache-2.0
 
  Licensed under the Apache License, Version 2.0 (the License); you may
  not use this file except in compliance with the License.
  You may obtain a copy of the License at
 
  www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS, WITHOUT
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  $Date:        1. Dec 2020
  $Revision:    1.7.2

  $Project: Schema File for Package Description File Format Specification

  Package file name convention <vendor>.<name>.<version>.pack
  SchemaVersion=1.7.2
  
  1. December 2020: v1.7.2
   - added 'XC' to CompilerEnumType to enable use of Microchip XC32 compiler 

  13. November 2020: v1.7.1
  - undo removing deprecated attributes as they are still used in latest pdsc file versions:
    DeviceVendorEnum: Lapis Semiconductor, DeviceVendorEnum: Pname, BoardReferenceType: Dvendor, Dname
  - added condition attribute to TaxonomyDescriptionType supporting context specific taxonomies (e.g. vendor or device specific)

  14. September 2020: v1.7.0
  - added processor attribute Dcdecp for implemented Custom Datapath Extension Coprocessors (Cortex-M33)
  - extended BoardType added DebugProbeType and FlashAlgorithm.
  - removed types and references used by deprecated cprj format.
  
  26. March 2020: v1.6.3
  - added 'folder' attribute to example's <environment> element.
  - added 'ACCESS_AP' to DataPatchAccessTypeEnum.
  - added 'Cortex-M55' to DcoreEnum.
  - added 'uninit' attribute <memory> element to replace deprecated 'init' attribute.
  - updated 'DmveEnum' strings to align with specification.
  - reduced minimum length of Cclass, Cgroup and Cvariant names from 3 to 2.
  - deprecating all types specific to cpdsc format. Cpdsc is replaced by Cprj with dedicated schema.

  05. November 2019: v1.6.2
  - added <accessportV1> and <accessportV2> to describe CoreSight access port parameters.
  - added attribute '__apid' to <debug> and <datapatch> to reference <accessportV1> and <accessportV2> elements.
  - added attribute 'dormant' to <debugconfig> element.

  24. October 2019: 1.6.1
  - added value to DsecureEnum: 2 = TZ-disabled.
  - added component boolean attribute 'custom', indicating that the component requires implementation.
  - updated DmveEnum to select between single and double precision floating point support (MVE_FP deprecated).
  
  14. March 2019: 1.6.0
  - added Armv8.1-M MVE processor feature attribute 'Dmve'.
  - added local and global pre-include section Pre_Include_Local_Component_h, Pre_Include_Global_h.
  - added file categories 'preIncludeLocal' and 'preIncludeGlobal' FileCategoryEnum.
  - added file attribute 'path' for file category 'header' to add support for relative include paths. 
  - added to package element the possibility to restrict the usage of the with attributes Dvendor, Dname, Dcore, and Tcompiler.
  - added dominate element to overwrite identical APIs, or components.
  - added attribute 'condition' to the api element so that an API can be excluded based on a condition.
  - added new Software Component Cclasses : "Audio", "Board Part", "Data Exchange", "Extension Board", "IoT Client", "IoT Utility", "Security", "Utility".

  19. July 2018: 1.5.0
  - added flash info section required for flash programming via debug sequences
  - added debug access functions and global debug variables for flash programming via debug sequences
  - added repository tag for specifying origin of public repositories

  25. January 2017: 1.4.9
  - added Toptions attribute for use in conditions

  21. November 2016: 1.4.8
  - added support for semantic versioning quality information in ConditionVersionType
  - relaxed schema by making some more elements optional
  
  07. November 2016: 1.4.7
  - added multiple version types to tighten the schema checking depending on context
  - added new generator sections for exe, web and eclipse based generators
  - added new processor attributes Dtz = Trustzone and Ddsp = DSP instructions for ARMv8-M
  - added new attributes Dtz, Ddsp, Dsecure to conditions
  - added new processors Cortex-M23 and Cortex-M33
  - added new attribute public to books and images to indicate public use of documents and board images
  
  12. July 2016: 1.4.6
  - refined Dname string pattern restriction
  
  13. June 2016: 1.4.5
  - added: Punits to ProcessorType
  - added: Punit to DebugType
  
  26. April 2016: 1.4.4
  - added: attribute defaultResetSequence to DebugType.
  - added: <requirements> section:
    - <packages> defining dependencies between packs
    - <languages> defining required language support e.g. C99
    - <compiler> defining required toolchains
  - added: <create> section used for tool independent project description
    - attributes: name, documentation, condition
    - <target> specifies the board and device targeted by the project 
    - <options> 
    - <files> specifies the grouped files 
  - updated: <algorith> element
    - added attributes: style, parameter and endian
  - updated: <memory> element
    - added attributes: name, access and alias
    - deprecating attribute: id (replaced by name + access)
    
  03. Dec 2015: 1.4.3
  - adding attribute "sdf" to devices section element debugconfig
  
  16. Oct 2015: 1.4.1
  - Pname, Dname, Dvariant type changed from xs:string to RestrictedString

  28. Aug 2015: 1.4.0
  - deprecate devices memory tag attribute id and use
    introduced name and access attributes instead
  - added devices memory tag attribute: alias
  - added devices algorithm tag attribute: style
  - added attribute to define a default component variant
  - added board book category: layout
  
  29. May 2015
  - added missing Pname attribute to GeneratorDeviceSelectType used for multi processor
    devices
  
  12. Jan. 2014
  - allow to link a component with a generator via new component attribute
  - generator command extended to deal with more sophisticated command lines / document sequence
  
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified" version="1.7.2">

  <!-- NonNegativeInteger specifies the format in which numbers are represented in hexadecimal or decimal format -->
  <xs:simpleType name="NonNegativeInteger">
    <xs:restriction base="xs:string">
      <xs:pattern value="[+]?(0x|0X)?[0-9a-fA-F]+" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Registered Device Vendors -->
  <xs:simpleType name="DeviceVendorEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ABOV Semiconductor:126" />
      <xs:enumeration value="Actel:56" />
      <xs:enumeration value="Active-Semi:140" />
      <xs:enumeration value="Alif Semiconductor:165" />
      <xs:enumeration value="Altera:85" />
      <xs:enumeration value="Altium:65" />
      <xs:enumeration value="Ambiq Micro:120" />
      <xs:enumeration value="Amiccom:147" />
      <xs:enumeration value="Analog Devices:1" />
      <xs:enumeration value="APEXMIC:153" />
      <xs:enumeration value="ARM:82" />
      <xs:enumeration value="ARM CMSIS:109" />
      <xs:enumeration value="ArmChina:160" />
      <xs:enumeration value="ArteryTek:143" />
      <xs:enumeration value="Atmel:3" />
      <xs:enumeration value="AutoChips:150" />
      <xs:enumeration value="BrainChip:168" />
      <xs:enumeration value="Cmsemicon:161" />
      <xs:enumeration value="CSR:118" />
      <xs:enumeration value="Cypress:19" />
      <xs:enumeration value="Dialog Semiconductor:113" />
      <xs:enumeration value="Dolphin:57" />
      <xs:enumeration value="Domosys:26" />
      <xs:enumeration value="ELAN:162" />
      <xs:enumeration value="Elmos Semiconductor AG:138" />
      <xs:enumeration value="Ember:98" />
      <xs:enumeration value="Energy Micro:97" />
      <xs:enumeration value="EnOcean:91" />
      <xs:enumeration value="e-peas:167" />
      <xs:enumeration value="EtaCompute:157" />
      <xs:enumeration value="Evatronix:64" />
      <xs:enumeration value="Geehy:163" />
      <xs:enumeration value="Generic:5" />
      <xs:enumeration value="Generalplus:151" />
      <xs:enumeration value="GigaDevice:123" />
      <xs:enumeration value="Goodix:155" />
      <xs:enumeration value="HDSC:145" />
      <xs:enumeration value="Hilscher:88" />
      <xs:enumeration value="Holtek:106" />
      <xs:enumeration value="Hynix Semiconductor:6" />
      <xs:enumeration value="Hyundai:35" />
      <xs:enumeration value="Infineon:7" />
      <xs:enumeration value="Kionix:127" />
      <xs:enumeration value="LAPIS Technology:10" />
      <xs:enumeration value="Lapis Semiconductor:10" />
      <xs:enumeration value="Linear Technology:136" />
      <xs:enumeration value="Luminary Micro:76" />
      <xs:enumeration value="Maxim:23" />
      <xs:enumeration value="MediaTek:129" />
      <xs:enumeration value="MegaChips:128" />
      <xs:enumeration value="Megawin:70" />
      <xs:enumeration value="Mentor Graphics Co.:24" />
      <xs:enumeration value="Microchip:3" />
      <xs:enumeration value="Micronas:30" />
      <xs:enumeration value="Microsemi:112" />
      <xs:enumeration value="Milandr:99" />
      <xs:enumeration value="MindMotion:132" />
      <xs:enumeration value="NetSilicon:67" />
      <xs:enumeration value="Nordic Semiconductor:54" />
      <xs:enumeration value="Nuvoton:18" />
      <xs:enumeration value="NXP:11" />
      <xs:enumeration value="OKI SEMICONDUCTOR CO.,LTD.:108" />
      <xs:enumeration value="ONSemiconductor:141" />
      <xs:enumeration value="Panasonic:131" />
      <xs:enumeration value="Realtek Semiconductor:124" />
      <xs:enumeration value="Redpine Signals:125" />
      <xs:enumeration value="RelChip:146" />
      <xs:enumeration value="Renesas:117" />
      <xs:enumeration value="ROHM:103" />
      <xs:enumeration value="Samsung:47" />
      <xs:enumeration value="SILAN:164" />
      <xs:enumeration value="Silergy Corp:139" />
      <xs:enumeration value="Silicon Labs:21" />
      <xs:enumeration value="Sinowealth:149" />
      <xs:enumeration value="SmartChip:156" />
      <xs:enumeration value="SONiX:110" />
      <xs:enumeration value="Spansion:100" />
      <xs:enumeration value="STMicroelectronics:13" />
      <xs:enumeration value="Sunrise Micro Devices:121" />
      <xs:enumeration value="Synwit:144" />
      <xs:enumeration value="TI:16" />
      <xs:enumeration value="Texas Instruments:16" />
      <xs:enumeration value="Toshiba:92" />
      <xs:enumeration value="Triad Semiconductor:104" />
      <xs:enumeration value="Unisoc:152" />
      <xs:enumeration value="Vorago:137" />
      <xs:enumeration value="Weltrend:148" />
      <xs:enumeration value="WIZnet:122" />
      <xs:enumeration value="Xiamen PengPai Microelectronics Co. Ltd:166" />
      <xs:enumeration value="Xinnova:135" />
      <xs:enumeration value="XMC:158" />
      <xs:enumeration value="Zilog:89" />
      <!-- deprecated: do not use -->
      <xs:enumeration value="Freescale:78" />
      <xs:enumeration value="Freescale Semiconductor:78" />
      <xs:enumeration value="NXP (founded by Philips):11" />
    </xs:restriction>
  </xs:simpleType>

  <!-- AlgorithmStyleType: allow support of different flash programming algorithm styles -->
  <xs:simpleType name="AlgorithmStyleType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="Keil" />
      <xs:enumeration value="IAR" />
      <xs:enumeration value="CMSIS" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Component Class Name Type: specify your own Class in taxonomy -->
  <xs:simpleType name="CclassType">
    <xs:restriction base="xs:string">
      <xs:minLength value="2" />
      <xs:maxLength value="32" />
      <xs:pattern value="\S(.*\S)?"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>

  <!-- Component Group Name Type (no leading or trailing spaces allowed) -->
  <xs:simpleType name="CgroupType">
    <xs:restriction base="xs:string">
      <xs:minLength value="2" />
      <xs:maxLength value="32" />
      <xs:pattern value="\S(.*\S)?"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>

  <!-- Component Sub Name Type -->
  <xs:simpleType name="CsubType">
    <xs:restriction base="xs:string">
      <xs:minLength value="0" />
      <xs:maxLength value="32" />
      <!-- <xs:pattern value="\S(.*\S)?"></xs:pattern> not backward compatible -->
    </xs:restriction>
  </xs:simpleType>

  <!-- Component Variant Name Type -->
  <xs:simpleType name="CvariantType">
    <xs:restriction base="xs:string">
      <xs:minLength value="2" />
      <xs:maxLength value="32" />
      <xs:pattern value="\S(.*\S)?"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>

  <!-- AccessType (added in 1.4.4) -->
  <xs:simpleType name="AccessType">
    <xs:restriction base="xs:string">
      <xs:pattern value="[rwxpsnc]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Hex8BitType">
    <xs:restriction base="xs:string">
      <xs:pattern value="(0x|0X)[0-9a-fA-F]{2}" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Processor Type -->
  <xs:complexType name="ProcessorType">
    <!-- Pname defines an identifier for a specific processor in a multi-processor devices -->
    <xs:attribute name="Pname" type="RestrictedString" />
    <!-- Punits specifies the number of processing units in a symmetric multi-processor core -->
    <xs:attribute name="Punits" type="InstancesType" />
    <!-- Dcore specifies the processor from a list of supported processors -->
    <xs:attribute name="Dcore" type="DcoreEnum" />
    <!-- Dfpu specifies the hardware floating point unit -->
    <xs:attribute name="Dfpu" type="DfpuEnum" />
    <!-- Dmpu specifies the memory protection unit -->
    <xs:attribute name="Dmpu" type="DmpuEnum" />
    <!-- Dtz specifies the processor TrustZone support -->
    <xs:attribute name="Dtz" type="DtzEnum" />
    <!-- Ddsp specifies the processor support for DSP instructions -->
    <xs:attribute name="Ddsp" type="DdspEnum" />
    <!-- Dmve specifies the processor Cortex-M vector extensions -->
    <xs:attribute name="Dmve" type="DmveEnum" />
    <!-- Dendian specifies the endianess supported by the processor -->
    <xs:attribute name="Dendian" type="DendianEnum" />
    <!-- Dclock specifies the maximum core clock frequency -->
    <xs:attribute name="Dclock" type="xs:unsignedInt" />
    <!-- DcoreVersion specifies the revision of the processor -->
    <xs:attribute name="DcoreVersion" type="xs:string" />
    <!-- Dcdecp specifies the custom datapath extension coprocessors that are implemented by the device (8bit hex value bitmask) -->
    <xs:attribute name="Dcdecp" type="Hex8BitType" />
  </xs:complexType>

  <!-- Compile Type: -->
  <xs:complexType name="CompileType">
    <!-- Pname identifies the processor this setting belongs to -->
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <!-- CMSIS-CORE device header file (sets compiler include path) -->
    <xs:attribute name="header" type="xs:string" />
    <!-- Device specific preprocessor define (sets preprocessor define  -->
    <xs:attribute name="define" type="xs:string" />
    <!-- Processor instance specific preprocessor define (sets preprocessor define on the commandline)  -->
    <xs:attribute name="Pdefine" type="xs:string" />
  </xs:complexType>

  <!-- DebugVarsType -->
  <xs:complexType name="DebugVarsType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="configfile" type="xs:string" use="optional" />
        <xs:attribute name="version" type="ComponentVersionType" use="optional" />
        <xs:attribute name="Pname" type="xs:string" use="optional" />
        <xs:anyAttribute processContents="lax" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- Debug Link -->
  <xs:simpleType name="DebugLinkEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="jtag" />
      <xs:enumeration value="cjtag" /> <!-- deprecated -->
      <xs:enumeration value="swd" />
    </xs:restriction>
  </xs:simpleType>

  <!-- DebugConfigType -->
  <xs:complexType name="DebugConfigType">
    <xs:attribute name="default" type="DebugLinkEnum" use="optional" default="swd" />
    <xs:attribute name="clock" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="swj" type="xs:boolean" use="optional" />
    <xs:attribute name="dormant" type="xs:boolean" use="optional" />
    <!-- Debugger System Description File -->
    <xs:attribute name="sdf" type="xs:string" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- JtagType -->
  <xs:complexType name="JtagType">
    <xs:attribute name="tapindex" type="NonNegativeInteger" use="optional" />
    <xs:attribute name="idcode" type="NonNegativeInteger" use="optional" />
    <xs:attribute name="targetsel" type="NonNegativeInteger" use="optional" />
    <xs:attribute name="irlen" type="xs:unsignedInt" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- SwdType -->
  <xs:complexType name="SwdType">
    <xs:attribute name="idcode" type="NonNegativeInteger" use="optional" />
    <xs:attribute name="targetsel" type="NonNegativeInteger" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- DebugPortType -->
  <xs:complexType name="DebugPortType">
    <xs:sequence>
      <xs:element name="jtag" type="JtagType" minOccurs="0" maxOccurs="1" />
      <xs:element name="swd"  type="SwdType"  minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="__dp" type="xs:unsignedInt" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- AccessPortV1Type -->
  <xs:complexType name="AccessPortV1Type">
    <xs:attribute name="__apid" type="xs:unsignedInt" use="required" />
    <xs:attribute name="__dp" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="index" type="xs:unsignedInt" use="required" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>
  
  <!-- AccessPortV2Type -->
  <xs:complexType name="AccessPortV2Type">
    <xs:attribute name="__apid" type="xs:unsignedInt" use="required" />
    <xs:attribute name="__dp" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="address" type="xs:unsignedInt" use="required" />
    <xs:attribute name="parent" type="xs:unsignedInt" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- DataPatchAccessTypeEnum enumeration type -->
  <xs:simpleType name="DataPatchAccessTypeEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="DP" />
      <xs:enumeration value="AP" />
      <xs:enumeration value="ACCESS_AP" />
      <xs:enumeration value="Mem" />
    </xs:restriction>
  </xs:simpleType>

  <!-- ExpressionType -->
  <xs:simpleType name="ExpressionType">
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <!-- DataPatchType -->
  <xs:complexType name="DataPatchType">
    <xs:attribute name="type" type="DataPatchAccessTypeEnum" use="optional" />
    <xs:attribute name="address" type="NonNegativeInteger" use="required" />
    <xs:attribute name="__dp" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="__ap" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="value" type="NonNegativeInteger" use="required" />
    <xs:attribute name="mask" type="NonNegativeInteger" use="optional" />
    <xs:attribute name="info" type="xs:string" use="optional" />
    <xs:attribute name="__apid" type="xs:unsignedInt" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- BlockType -->
  <xs:complexType name="SequenceBlockType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="atomic" type="xs:boolean" use="optional" />
        <xs:attribute name="info" type="xs:string" use="optional" />
        <xs:anyAttribute processContents="lax" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- ControlType -->
  <xs:complexType name="SequenceControlType">
    <xs:sequence>
      <xs:group ref="SequenceElementGroup" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="if" type="xs:string" use="optional" />
    <xs:attribute name="while" type="ExpressionType" use="optional" />
    <xs:attribute name="timeout" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="info" type="xs:string" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- SequenceElementType -->
  <xs:group name="SequenceElementGroup">
    <xs:choice>
      <xs:element name="block" type="SequenceBlockType" />
      <xs:element name="control" type="SequenceControlType" />
    </xs:choice>
  </xs:group>

  <!-- SequenceType -->
  <xs:complexType name="SequenceType">
    <xs:sequence>
      <xs:group ref="SequenceElementGroup" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <xs:attribute name="disable" type="xs:boolean" use="optional" />
    <xs:attribute name="info" type="xs:string" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- SequencesType -->
  <xs:complexType name="SequencesType">
    <xs:sequence>
      <xs:element name="sequence" type="SequenceType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- DebugType -->
  <xs:complexType name="DebugType">
    <xs:sequence>
      <xs:element name="datapatch" type="DataPatchType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="__dp" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="__ap"  type="xs:unsignedInt" use="optional"/> <!-- access port index -->
    <xs:attribute name="address" type="NonNegativeInteger" use="optional"/> <!-- CPU debug block base address -->
    <xs:attribute name="svd"   type="xs:string"      use="optional"/>
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <xs:attribute name="Punit" type="xs:unsignedInt" use="optional" />
    <xs:attribute name="defaultResetSequence" type="xs:string" use="optional" />
    <xs:attribute name="__apid" type="xs:unsignedInt" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- SerialWireType -->
  <xs:complexType name="SerialWireType">
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- TracePortType -->
  <xs:complexType name="TracePortType">
    <xs:attribute name="width" type="NonNegativeInteger" use="optional" />
    <xs:anyAttribute processContents="skip" />
  </xs:complexType>

  <!-- TraceBufferType -->
  <xs:complexType name="TraceBufferType">
    <xs:attribute name="start" type="NonNegativeInteger" use="optional" />
    <xs:attribute name="size" type="NonNegativeInteger" use="optional" />
    <xs:anyAttribute processContents="skip" />
  </xs:complexType>

  <!-- TraceType -->
  <xs:complexType name="TraceType">
    <xs:sequence>
      <xs:element name="serialwire" type="SerialWireType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="traceport" type="TracePortType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="tracebuffer" type="TraceBufferType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <xs:anyAttribute processContents="lax" />
  </xs:complexType>

  <!-- Memory Type-->
  <xs:complexType name="MemoryType">
    <!-- Pname identifies the processor this setting belongs to -->
    <xs:attribute name="Pname" type="RestrictedString" />
    <!-- id specifies the enumerated ID of memory (deprecated in 1.4.4) -->
    <xs:attribute name="id" type="MemoryIDTypeEnum" use="optional" />
    <!-- name specifies an identifier being use to refer to this memory range description (added in 1.4.4) -->
    <xs:attribute name="name" type="RestrictedString" use="optional" />
    <!-- start specifies the base address of the memory -->
    <xs:attribute name="start" type="NonNegativeInteger" use="required" />
    <!-- size specifies the size of the memory -->
    <xs:attribute name="size" type="NonNegativeInteger" use="required" />
    <!-- access: specifies the access permissions of the memory (added in 1.4.4) -->
    <xs:attribute name="access" type="AccessType" use="optional" default="r" />
    <!-- alias: reference to another memory by 'name' to express that the same physical memory is mapped at another address (added in 1.4.4) -->
    <xs:attribute name="alias" type="RestrictedString" use="optional" />
    <!-- !!! deprecated, do not use / ignore !!! specifies whether the memory shall NOT be 0 initialized , use uninit instead-->
    <xs:attribute name="init" type="xs:boolean" use="optional" default="0" />
    <!-- specifies whether the memory shall not be 0 initialized -->
    <xs:attribute name="uninit" type="xs:boolean" use="optional" default="0" />
    <!-- specifies whether the memory is used as default by linker -->
    <xs:attribute name="default" type="xs:boolean" use="optional" default="0" />
    <!-- specifies whether the memory shall be used for the startup by linker -->
    <xs:attribute name="startup" type="xs:boolean" use="optional" default="0" />
  </xs:complexType>

  <!-- Algorithm Type -->
  <xs:complexType name="AlgorithmType">
    <!-- only used by board descriptions with multiple mounted devices -->
    <xs:attribute name="deviceIndex" type="xs:string" use="optional" />
    <!-- Pname identifies the processor this setting belongs to -->
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <!-- name specifies the path and filename of the Flash Programming Algorithm -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- start specifies the base address of the memory range that gets programmed -->
    <xs:attribute name="start" type="NonNegativeInteger" use="optional" />
    <!-- size specifies the size of the memory range that gets programmed -->
    <xs:attribute name="size" type="NonNegativeInteger" use="optional" />
    <!-- RAMstart specifies the base address in RAM from where the algorithm is executed -->
    <xs:attribute name="RAMstart" type="NonNegativeInteger" use="optional" />
    <!-- RAMsize specifies the available RAM for executing the algorithm -->
    <xs:attribute name="RAMsize" type="NonNegativeInteger" use="optional" />
    <!-- if default is set the algorithm will be configured for any new project -->
    <xs:attribute name="default" type="xs:boolean" use="optional" default="0" />
    <!-- style attribute: specifies the programming algorithm format (added in 1.4.4) -->
    <xs:attribute name="style" type="AlgorithmStyleType" use="optional" default="Keil" />
    <!-- parameter attribute: parmeter passed on algorithm invocation (added in 1.4.4) -->
    <xs:attribute name="parameter" type="xs:string" use="optional" />
    <!-- endian attribute: specifies the endianess of the algorithm (added in 1.4.4) -->
    <xs:attribute name="endian" type="DendianEnum" use="optional" default="Little-endian" />
  </xs:complexType>

  <!-- Flash Info Block Type -->
  <xs:complexType name="FlashInfoBlockType">
    <!-- count specifies the number of subsequent blocks with identical properties -->
    <xs:attribute name="count" type="NonNegativeInteger" use="required"/>
    <!-- size specifies the block size in bytes -->
    <xs:attribute name="size"  type="NonNegativeInteger" use="required"/>
    <!-- arg specifies an optional argument to pass to a sequence that is part of a flash operation -->
    <xs:attribute name="arg"   type="NonNegativeInteger" use="optional"/>
  </xs:complexType>

  <!-- Flash Info Gap Type -->
  <xs:complexType name="FlashInfoGapType">
    <!-- size specifies the gap size in bytes -->
    <xs:attribute name="size" type="NonNegativeInteger" use="required"/>
  </xs:complexType>
  
  <!-- Flash Info Element Group -->
  <xs:group name="FlashInfoElementGroup">
    <xs:choice>
      <xs:element name="block" type="FlashInfoBlockType"/>
      <xs:element name="gap"   type="FlashInfoGapType"/>
    </xs:choice>
  </xs:group>
  
  <!-- Flash Info Type -->
  <xs:complexType name="FlashInfoType">
    <xs:sequence>
      <xs:group   ref="FlashInfoElementGroup" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
    <!-- name specifies the name of the flash device -->
    <xs:attribute name="name"     type="xs:string"          use="required"/>
    <!-- start specifies the base address of the flash device as mapped into target memory system -->
    <xs:attribute name="start"    type="NonNegativeInteger" use="required"/>
    <!-- pagesize specifies the programming page size -->
    <xs:attribute name="pagesize" type="NonNegativeInteger" use="required"/>
    <!-- blankval specifies the expected memory value for unprogrammed address ranges -->
    <xs:attribute name="blankval" type="NonNegativeInteger" use="optional"/>
    <!-- filler specifies the value that a debugger uses to fill the remainder of a programming page -->
    <xs:attribute name="filler"   type="NonNegativeInteger" use="optional"/>
    <!-- ptime specifies the timeout in milliseconds for programming a page -->
    <xs:attribute name="ptime"    type="xs:unsignedInt"     use="optional"/>
    <!-- etime specifies the timeout in milliseconds for erasing a sector -->
    <xs:attribute name="etime"    type="xs:unsignedInt"     use="optional"/>
    <!-- Pname identifies the processor this setting belongs to -->
    <xs:attribute name="Pname"    type="RestrictedString"   use="optional"/>
  </xs:complexType>

  <!-- Book Type -->
  <xs:complexType name="BookType">
    <!-- Pname identifies the processor this setting belongs to -->
    <xs:attribute name="Pname" type="RestrictedString" />
    <!-- name specifies the path and filename of the document -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- title specifies the string displayed for this document -->
    <xs:attribute name="title" type="xs:string" use="required" />
    <!-- if true, the vendor gives permission for this file being extracted from the pack and displayed on a web-page -->
    <!-- links to web pages are assumed public -->
    <xs:attribute name="public" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>

  <!-- Description Type-->
  <xs:complexType name="DescriptionType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <!-- Pname identifies the processor this setting belongs to -->
        <xs:attribute name="Pname" type="RestrictedString" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- Device Feature Type -->
  <xs:complexType name="DeviceFeatureType">
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <!-- <xs:attribute name="type"  type="DeviceFeatureTypeEnum" use="required"/> -->
    <xs:attribute name="type" type="xs:string" use="required" />
    <xs:attribute name="n" type="xs:decimal" use="optional" />
    <xs:attribute name="m" type="xs:decimal" use="optional" />
    <xs:attribute name="name" type="xs:string" use="optional" />
    <!-- deprecated, only for backwards compatibility -->
    <xs:attribute name="count" type="xs:int" use="optional" />
  </xs:complexType>

  <!-- Board Feature Type -->
  <xs:complexType name="BoardFeatureType">
    <!-- <xs:attribute name="type"  type="BoardFeatureTypeEnum" use="required"/> -->
    <xs:attribute name="type" type="xs:string" use="required" />
    <xs:attribute name="n" type="xs:decimal" use="optional" />
    <xs:attribute name="m" type="xs:decimal" use="optional" />
    <xs:attribute name="name" type="xs:string" use="optional" />
  </xs:complexType>

  <!-- Environment Type -->
  <xs:complexType name="EnvironmentType">
    <xs:sequence>
      <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <!-- name identifies the environment (e.g. "uv" for uVision ) this setting belongs to -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- Pname identifies the processor this setting belongs to -->
    <xs:attribute name="Pname" type="RestrictedString" use="optional" />
    <xs:anyAttribute></xs:anyAttribute>
  </xs:complexType>

  <!-- Default Device Properties Group -->
  <xs:group name="DefaultDevicePropertiesGroup">
    <!-- multi-core devices have unique Pname attribute. One entry per processor and level -->
    <xs:choice>
      <xs:element name="compile" type="CompileType" />
      <xs:element name="memory" type="MemoryType" />
      <xs:element name="algorithm" type="AlgorithmType" />
      <xs:element name="book" type="BookType" />
      <xs:element name="description" type="DescriptionType" />
      <xs:element name="feature" type="DeviceFeatureType" />
      <xs:element name="environment" type="EnvironmentType" />
      <xs:element name="debugport" type="DebugPortType" />
      <xs:element name="accessportV1" type="AccessPortV1Type" />
      <xs:element name="accessportV2" type="AccessPortV2Type" />
      <xs:element name="debug" type="DebugType" />
      <xs:element name="trace" type="TraceType" />
      <xs:element name="debugvars" type="DebugVarsType" />
      <xs:element name="sequences" type="SequencesType" />
      <xs:element name="flashinfo"   type="FlashInfoType"   />
    </xs:choice>
  </xs:group>

  <!-- Device Properties Group -->
  <xs:group name="DevicePropertiesGroup">
    <!-- multi-core devices have unique Pname attribute. One entry per processor and level -->
    <xs:sequence>
      <!-- date of deprecation of family, subFamily, device and variant depending on position in the hierachy -->
      <xs:element name="deprecated"  type="xs:date"         minOccurs="0"/>
      <xs:element name="processor" type="ProcessorType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="debugconfig" type="DebugConfigType" minOccurs="0" maxOccurs="1" />
      <xs:group ref="DefaultDevicePropertiesGroup" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:group>

  <xs:complexType name="DeviceType">
    <xs:sequence>
      <xs:group ref="DevicePropertiesGroup" />
      <!-- Variant Level begin-->
      <xs:element name="variant" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="DevicePropertiesGroup" />
          </xs:sequence>
          <xs:attribute name="Dvariant" type="RestrictedStringDname" use="required" />
        </xs:complexType>
      </xs:element>
      <!-- Variant Level end -->
    </xs:sequence>
    <xs:attribute name="Dname" type="RestrictedStringDname" use="required" />
    <!-- <xs:attributeGroup ref="DefaultDeviceAttributesGroup"/> -->
  </xs:complexType>

  <!-- Dcore enumeration type -->
  <xs:simpleType name="DcoreEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="SC000" />
      <xs:enumeration value="SC300" />
      <xs:enumeration value="Cortex-M0" />
      <xs:enumeration value="Cortex-M0+" />
      <xs:enumeration value="Cortex-M1" />
      <xs:enumeration value="Cortex-M23" />
      <xs:enumeration value="Cortex-M3" />
      <xs:enumeration value="Cortex-M33" />
      <xs:enumeration value="Cortex-M35P"/>
      <xs:enumeration value="Cortex-M55"/>
      <xs:enumeration value="Cortex-M4" />
      <xs:enumeration value="Cortex-M7" />
      <xs:enumeration value="ARMV8MBL" />
      <xs:enumeration value="ARMV8MML" />
      <xs:enumeration value="ARMV81MML"/>
      <xs:enumeration value="Cortex-R4" />
      <xs:enumeration value="Cortex-R5" />
      <xs:enumeration value="Cortex-R7" />
      <xs:enumeration value="Cortex-R8" />
      <xs:enumeration value="Cortex-A5" />
      <xs:enumeration value="Cortex-A7" />
      <xs:enumeration value="Cortex-A8" />
      <xs:enumeration value="Cortex-A9" />
      <xs:enumeration value="Cortex-A15" />
      <xs:enumeration value="Cortex-A17" />
      <xs:enumeration value="Cortex-A53" />
      <xs:enumeration value="Cortex-A57" />
      <xs:enumeration value="Cortex-A72" />
      <xs:enumeration value="Cortex-A73" />
      <xs:enumeration value="other" />
    </xs:restriction>
  </xs:simpleType>

  <!-- DeviceFeatureTypeEnum -->
  <xs:simpleType name="DeviceFeatureTypeEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="Crypto" />
      <xs:enumeration value="NVIC" />
      <xs:enumeration value="DMA" />
      <xs:enumeration value="RNG" />
      <xs:enumeration value="CoreOther" />
      <xs:enumeration value="ExtBus" />
      <xs:enumeration value="Memory" />
      <xs:enumeration value="MemoryOther" />
      <xs:enumeration value="XTAL" />
      <xs:enumeration value="IntRC" />
      <xs:enumeration value="PLL" />
      <xs:enumeration value="RTC" />
      <xs:enumeration value="ClockOther" />
      <xs:enumeration value="PowerMode" />
      <xs:enumeration value="VCC" />
      <xs:enumeration value="Consumption" />
      <xs:enumeration value="PowerOther" />
      <xs:enumeration value="BGA" />
      <xs:enumeration value="CSP" />
      <xs:enumeration value="PLCC" />
      <xs:enumeration value="QFN" />
      <xs:enumeration value="QFP" />
      <xs:enumeration value="SOP" />
      <xs:enumeration value="DIP" />
      <xs:enumeration value="PackageOther" />
      <xs:enumeration value="IOs" />
      <xs:enumeration value="ExtInt" />
      <xs:enumeration value="Temp" />
      <xs:enumeration value="ADC" />
      <xs:enumeration value="DAC" />
      <xs:enumeration value="TempSens" />
      <xs:enumeration value="AnalogOther" />
      <xs:enumeration value="PWM" />
      <xs:enumeration value="Timer" />
      <xs:enumeration value="WDT" />
      <xs:enumeration value="TimerOther" />
      <xs:enumeration value="MPSerial" />
      <xs:enumeration value="CAN" />
      <xs:enumeration value="ETH" />
      <xs:enumeration value="I2C" />
      <xs:enumeration value="I2S" />
      <xs:enumeration value="LIN" />
      <xs:enumeration value="SDIO" />
      <xs:enumeration value="SPI" />
      <xs:enumeration value="UART" />
      <xs:enumeration value="USART" />
      <xs:enumeration value="USBD" />
      <xs:enumeration value="USBH" />
      <xs:enumeration value="USBOTG" />
      <xs:enumeration value="ComOther" />
      <xs:enumeration value="Camera" />
      <xs:enumeration value="GLCD" />
      <xs:enumeration value="LCD" />
      <xs:enumeration value="Touch" />
      <xs:enumeration value="Other" />
      <xs:enumeration value="GPU" />
      <xs:enumeration value="AI" />
      <xs:enumeration value="FPGA" />
      <xs:enumeration value="Application" />
      <xs:enumeration value="IrDA" />
      <xs:enumeration value="HDMI" />
      <xs:enumeration value="MIPI" />
      <xs:enumeration value="PCIe" />
      <xs:enumeration value="Bluetooth" />
      <xs:enumeration value="ZigBee" />
      <xs:enumeration value="802.15.4" />
      <xs:enumeration value="WiFi" />
      <xs:enumeration value="LoRa" />
      <xs:enumeration value="LTE Cat-M" />
      <xs:enumeration value="NB-IoT" />
      <xs:enumeration value="NFC" />
      <xs:enumeration value="WirelessOther" />
      <!-- deprecated, only for backwards compatibility -->
      <xs:enumeration value="I/O" />
      <xs:enumeration value="D/A" />
      <xs:enumeration value="A/D" />
      <xs:enumeration value="Com" />
      <xs:enumeration value="USB" />
      <xs:enumeration value="Package" />
      <xs:enumeration value="Backup" />
    </xs:restriction>
  </xs:simpleType>

  <!-- BoardFeatureTypeEnum -->
  <xs:simpleType name="BoardFeatureTypeEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="ODbg" />
      <xs:enumeration value="XTAL" />
      <xs:enumeration value="PWR" />
      <xs:enumeration value="PWR" />
      <xs:enumeration value="PWRSock" />
      <xs:enumeration value="Batt" />
      <xs:enumeration value="Curr" />
      <xs:enumeration value="CoreOther" />
      <xs:enumeration value="RAM" />
      <xs:enumeration value="ROM" />
      <xs:enumeration value="Memory" />
      <xs:enumeration value="MemCard" />
      <xs:enumeration value="MemoryOther" />
      <xs:enumeration value="DIO" />
      <xs:enumeration value="AIO" />
      <xs:enumeration value="Proto" />
      <xs:enumeration value="USB" />
      <xs:enumeration value="ETH" />
      <xs:enumeration value="SPI" />
      <xs:enumeration value="I2C" />
      <xs:enumeration value="RS232" />
      <xs:enumeration value="RS422" />
      <xs:enumeration value="RS485" />
      <xs:enumeration value="CAN" />
      <xs:enumeration value="IrDA" />
      <xs:enumeration value="LineIn" />
      <xs:enumeration value="LineOut" />
      <xs:enumeration value="MIC" />
      <xs:enumeration value="Edge" />
      <xs:enumeration value="ConnOther" />
      <xs:enumeration value="Button" />
      <xs:enumeration value="Poti" />
      <xs:enumeration value="Joystick" />
      <xs:enumeration value="Touch" />
      <xs:enumeration value="ContOther" />
      <xs:enumeration value="Accelerometer" />
      <xs:enumeration value="Gyro" />
      <xs:enumeration value="Compass" />
      <xs:enumeration value="TempSens" />
      <xs:enumeration value="PressSens" />
      <xs:enumeration value="LightSens" />
      <xs:enumeration value="SensOther" />
      <xs:enumeration value="CustomFF" />
      <xs:enumeration value="ArduinoFF" />
      <xs:enumeration value="FreedomFF" />
      <xs:enumeration value="TowerFF" />
      <xs:enumeration value="LED" />
      <xs:enumeration value="Camera" />
      <xs:enumeration value="LCD" />
      <xs:enumeration value="GLCD" />
      <xs:enumeration value="Speaker" />
      <xs:enumeration value="Other" />
    </xs:restriction>
  </xs:simpleType>

  <!-- eraseTypeEnum -->
  <xs:simpleType name="EraseTypeEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="sector" />
      <xs:enumeration value="full" />
      <xs:enumeration value="no" />
    </xs:restriction>
  </xs:simpleType>

  <!-- MemoryIDTypeEnum -->
  <xs:simpleType name="MemoryIDTypeEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="IRAM1" />
      <xs:enumeration value="IRAM2" />
      <xs:enumeration value="IRAM3" />
      <xs:enumeration value="IRAM4" />
      <xs:enumeration value="IRAM5" />
      <xs:enumeration value="IRAM6" />
      <xs:enumeration value="IRAM7" />
      <xs:enumeration value="IRAM8" />
      <xs:enumeration value="IROM1" />
      <xs:enumeration value="IROM2" />
      <xs:enumeration value="IROM3" />
      <xs:enumeration value="IROM4" />
      <xs:enumeration value="IROM5" />
      <xs:enumeration value="IROM6" />
      <xs:enumeration value="IROM7" />
      <xs:enumeration value="IROM8" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Dendian enumeration type -->
  <xs:simpleType name="DendianEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="Little-endian" />
      <xs:enumeration value="Big-endian" />
      <xs:enumeration value="Configurable" />
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Dfpu enumeration type -->
  <xs:simpleType name="DfpuEnum">
    <xs:restriction base="xs:token">
      <!-- core has FPU (type of FPU depends on Dcore) -->
      <xs:enumeration value="FPU" />
      <xs:enumeration value="1" />
      <!-- core has no FPU -->
      <xs:enumeration value="NO_FPU" />
      <xs:enumeration value="0" />
      <!-- single precision FPU -->
      <xs:enumeration value="SP_FPU" />
      <!-- double precision FPU -->
      <xs:enumeration value="DP_FPU" />
      <!-- any -->
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Dmpu enumeration type -->
  <xs:simpleType name="DmpuEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="MPU" />
      <xs:enumeration value="NO_MPU" />
      <xs:enumeration value="0" />
      <xs:enumeration value="1" />
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Dtz TrustZone enumeration type -->
  <xs:simpleType name="DtzEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="TZ" />
      <xs:enumeration value="NO_TZ" />
      <xs:enumeration value="1" />
      <xs:enumeration value="0" />
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Dsecure enumeration type -->
  <xs:simpleType name="DsecureEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="Non-secure" />
      <xs:enumeration value="Secure" />
      <xs:enumeration value="TZ-disabled" />
      <xs:enumeration value="0" />
      <xs:enumeration value="1" />
      <xs:enumeration value="2" />
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Ddsp DSP extensions enumeration type -->
  <xs:simpleType name="DdspEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="DSP" />
      <xs:enumeration value="NO_DSP" />
      <xs:enumeration value="1" />
      <xs:enumeration value="0" />
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Dmve extension enumeration type -->
  <xs:simpleType name="DmveEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="NO_MVE"/>
      <xs:enumeration value="MVE"/>
      <xs:enumeration value="FP_MVE"/>
      <xs:enumeration value="*"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- repository types -->
  <xs:simpleType name="RepositoryTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="git"/>
      <xs:enumeration value="svn"/>
      <xs:enumeration value="other"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- file category type -->
  <xs:simpleType name="FileCategoryType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="doc" />
      <xs:enumeration value="header" />
      <xs:enumeration value="include" />
      <xs:enumeration value="library" />
      <xs:enumeration value="object" />
      <xs:enumeration value="source" />
      <xs:enumeration value="sourceC" />
      <xs:enumeration value="sourceCpp" />
      <xs:enumeration value="sourceAsm" />
      <xs:enumeration value="linkerScript" />
      <xs:enumeration value="utility" />
      <xs:enumeration value="image" />
      <xs:enumeration value="other" />
      <xs:enumeration value="preIncludeGlobal"/>
      <xs:enumeration value="preIncludeLocal"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- file attribute type -->
  <xs:simpleType name="FileAttributeType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="config" />
      <xs:enumeration value="copy" />
      <xs:enumeration value="template" />
      <xs:enumeration value="interface" />
    </xs:restriction>
  </xs:simpleType>


  <!-- compiler toolchain enumeration -->
  <xs:simpleType name="CompilerEnumType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="GCC" />
      <xs:enumeration value="ARMCC" />
      <xs:enumeration value="IAR" />
      <xs:enumeration value="Tasking" />
      <xs:enumeration value="GHS" />
      <xs:enumeration value="Cosmic" />
      <xs:enumeration value="G++"/> <!-- Code Sourcery -->
      <xs:enumeration value="XC"/> <!-- Microchip MPLAB XC32 -->
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- compiler specific options/mode -->
  <xs:simpleType name="CompilerOptionsEnumType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="AC5" />
      <xs:enumeration value="AC6" />
      <xs:enumeration value="AC6LTO" />
    </xs:restriction>
  </xs:simpleType>

  <!-- compiler output enumeration -->
  <xs:simpleType name="CompilerOutputType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="exe" /> <!-- executable -->
      <xs:enumeration value="lib" /> <!-- library -->
      <xs:enumeration value="*" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="FilterType">
    <xs:attribute name="Dfamily" type="xs:string" /> <!-- deprecated as they are too weak for filtering -->
    <xs:attribute name="DsubFamily" type="xs:string" /> <!-- deprecated as they are too weak for filtering -->
    <xs:attribute name="Dvariant" type="xs:string" />
    <xs:attribute name="Dvendor" type="DeviceVendorEnum" />
    <xs:attribute name="Dname" type="xs:string" /> <!-- can contain wildcards ?* in condition -->
    <xs:attribute name="Dcore" type="DcoreEnum" />
    <xs:attribute name="Dfpu" type="DfpuEnum" />
    <xs:attribute name="Dmpu" type="DmpuEnum" />
    <xs:attribute name="Dtz" type="DtzEnum" />
    <xs:attribute name="Ddsp" type="DdspEnum" />
    <xs:attribute name="Dmve" type="DmveEnum" />
    <xs:attribute name="Dsecure" type="DsecureEnum" />
    <xs:attribute name="Dendian" type="DendianEnum" />
    <xs:attribute name="Pname" type="RestrictedString" />
    <xs:attribute name="Cvendor" type="xs:string" />
    <xs:attribute name="Cbundle" type="xs:string" />
    <xs:attribute name="Cclass" type="CclassType" />
    <xs:attribute name="Cgroup" type="CgroupType" />
    <xs:attribute name="Csub" type="CsubType" />
    <xs:attribute name="Cvariant" type="CvariantType" />
    <xs:attribute name="Cversion" type="ConditionVersionType" />
    <xs:attribute name="Capiversion" type="ConditionVersionType" />
    <xs:attribute name="Tcompiler" type="CompilerEnumType" />
    <!-- Toptions can only be used in combination with Tcompiler and the strings are predefined by the specification -->
    <xs:attribute name="Toptions" type="CompilerOptionsEnumType" />
    <xs:attribute name="Toutput" type="CompilerOutputType" />
    <xs:attribute name="condition" type="xs:string" />
  </xs:complexType>

  <!-- taxonomy description type definition -->
  <xs:complexType name="TaxonomyDescriptionType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <!-- Class the description is associated with -->
        <xs:attribute name="Cclass"    type="CclassType" use="required" />
         <!-- Group the description is associated with -->
        <xs:attribute name="Cgroup"    type="CgroupType" use="optional" />
        <!-- link to documentation for the :Class:[Group] -->
        <xs:attribute name="doc"       type="xs:string"  use="optional" />
        <!-- link a generator to a taxonomy -->
        <xs:attribute name="generator" type="xs:string"  use="optional" />
        <!-- allow to filter the taxonomy e.g. for a device vendor -->
        <xs:attribute name="condition" type="xs:string"  use="optional" />
        <!-- if true, the vendor gives permission for the doc file above being extracted from the pack and displayed on a web-page -->
        <!-- links to web pages are assumed public -->
        <xs:attribute name="public" type="xs:boolean"    use="optional" default="false" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="TaxonomyType">
    <xs:sequence>
      <xs:element name="description" type="TaxonomyDescriptionType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!-- API type definition -->
  <xs:complexType name="ApiType">
    <xs:sequence>
      <xs:element name="description" type="xs:string" minOccurs="0" />
      <!-- list of files / content -->
      <xs:element name="files">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="file" type="FileType" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="Cclass"      type="CclassType" use="required" />
    <xs:attribute name="Cgroup"      type="CgroupType" use="required" />
    <xs:attribute name="exclusive"   type="xs:boolean" use="optional" default="1" />
    <xs:attribute name="Capiversion" type="ComponentVersionType" use="optional" />
    <xs:attribute name="condition"   type="xs:string" use="optional" />
  </xs:complexType>

  <xs:complexType name="ApisType">
    <xs:sequence>
      <xs:element name="api" type="ApiType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ConditionType">
    <xs:sequence>
      <xs:element name="description" type="xs:string" minOccurs="0" />
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="accept"  type="FilterType" />
        <xs:element name="require" type="FilterType" />
        <xs:element name="deny"    type="FilterType" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="id" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ConditionsType">
    <xs:sequence>
      <xs:element name="condition" type="ConditionType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ComponentCategoryType">
    <xs:attribute name="Cvendor"     type="xs:string"            use="optional" />
    <xs:attribute name="Cbundle"     type="xs:string"            use="optional" />
    <xs:attribute name="Cclass"      type="CclassType"           use="required" />
    <xs:attribute name="Cgroup"      type="CgroupType"           use="optional" />
    <xs:attribute name="Csub"        type="CsubType"             use="optional" />
    <xs:attribute name="Cvariant"    type="CvariantType"         use="optional" />
    <xs:attribute name="Cversion"    type="ComponentVersionType" use="optional" />
    <xs:attribute name="Capiversion" type="ComponentVersionType" use="optional" />
    <xs:attribute name="instances"   type="InstancesType"        use="optional" default="1" />
  </xs:complexType>

  <xs:complexType name="ExampleProjectType">
    <xs:sequence>
      <xs:element name="environment" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name"   type="xs:string" use="required" />
          <xs:attribute name="load"   type="xs:string" use="required" />
          <xs:attribute name="folder" type="xs:string" use="optional" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="BoardReferenceType">
    <xs:attribute name="name"     type="xs:string" use="required" /> <!-- refers to Board Description by name   -->
    <xs:attribute name="vendor"   type="xs:string" use="required" /> <!-- refers to Board Description by vendor -->
    <xs:attribute name="revision" type="xs:string" use="optional" /> <!-- refers to Board Description by board revision -->
    <xs:attribute name="Dvendor"     type="DeviceVendorEnum" use="optional"/> <!-- deprecated in 1.2 -->
    <xs:attribute name="Dname"       type="xs:string"        use="optional"/> <!-- deprecated in 1.2 -->
  </xs:complexType>

  <xs:complexType name="CompatibleDeviceType">
    <xs:attribute name="deviceIndex" type="xs:string"        use="optional" />
    <xs:attribute name="Dvendor"     type="DeviceVendorEnum" use="optional" />
    <xs:attribute name="Dfamily"     type="xs:string"        use="optional" /> <!-- deprecated  -->
    <xs:attribute name="DsubFamily"  type="xs:string"        use="optional" /> <!-- deprecated -->
    <xs:attribute name="Dname"       type="xs:string"        use="optional" /> <!-- use wild card -->
  </xs:complexType>

  <xs:complexType name="BoardsDeviceType">
    <xs:attribute name="deviceIndex" type="xs:string"        use="optional" />
    <xs:attribute name="Dvendor"     type="DeviceVendorEnum" use="required" />
    <xs:attribute name="Dname"       type="xs:string"        use="required"/>
    <xs:attribute name="Dfamily"     type="xs:string"        use="optional"/> <!-- deprecated -->
    <xs:attribute name="DsubFamily"  type="xs:string"        use="optional"/> <!-- deprecated -->
  </xs:complexType>

  <xs:simpleType name="BoardBookCategoryEnum">
    <xs:restriction base="xs:token">
      <xs:enumeration value="setup" />
      <xs:enumeration value="schematic" />
      <xs:enumeration value="overview" />
      <xs:enumeration value="manual" />
      <xs:enumeration value="layout" />
      <xs:enumeration value="other" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="BoardsBookType">
    <xs:attribute name="category" type="BoardBookCategoryEnum" />
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="title" type="xs:string" />
    <!-- if true, the vendor gives permission for this file being extracted from the pack and displayed on a web-page -->
    <!-- links to web pages are assumed public -->
    <xs:attribute name="public" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>

  <!-- connectors for debug probes -->
  <xs:complexType name="DebugInterfaceType">
    <xs:attribute name="adapter"   type="xs:string" />
    <xs:attribute name="connector" type="xs:string" />
  </xs:complexType>

  <xs:simpleType name="DebugProbeNameEnumType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="CMSIS-DAP"/>
      <xs:enumeration value="DAP-Link"/>
      <xs:enumeration value="ST-Link"/>
    </xs:restriction>
  </xs:simpleType>
  
  <!-- on board debug probe -->
  <xs:complexType name="DebugProbeType">
    <xs:attribute name="deviceIndex" type="xs:string" use="optional" />
    <xs:attribute name="name"        type="DebugProbeNameEnumType" />
    <xs:attribute name="version"     type="xs:string" />
    <xs:attribute name="debugLink"   type="DebugLinkEnum" />
    <xs:attribute name="debugClock"  type="NonNegativeInteger" />
    <xs:attribute name="connector"   type="xs:string" />
  </xs:complexType>

  <xs:group name="BoardElementsGroup">
    <xs:choice>
      <xs:element name="description"      type="xs:string"            minOccurs="0" />
      <xs:element name="feature"          type="BoardFeatureType"     maxOccurs="unbounded" />
      <xs:element name="mountedDevice"    type="BoardsDeviceType"     maxOccurs="unbounded" />
      <xs:element name="compatibleDevice" type="CompatibleDeviceType" maxOccurs="unbounded" />
      <xs:element name="image" minOccurs="0">
        <xs:complexType>
          <xs:attribute name="small" type="xs:string" use="optional" />
          <xs:attribute name="large" type="xs:string" use="optional" />
          <!-- if true, the vendor gives permission for this file being extracted from the pack and displayed on a web-page -->
          <!-- links to web pages are assumed public -->
          <xs:attribute name="public" type="xs:boolean" use="optional" default="false" />
        </xs:complexType>
      </xs:element>
      <xs:element name="debugInterface"   type="DebugInterfaceType"    minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="book"             type="BoardsBookType"        minOccurs="0" maxOccurs="unbounded" />
      <!-- On-board debugger -->
      <xs:element name="debugProbe"       type="DebugProbeType"      minOccurs="0" maxOccurs="1" />
      <xs:element name="algorithm"        type="AlgorithmType"         minOccurs="0" maxOccurs="unbounded" />
    </xs:choice>
  </xs:group>

  <xs:complexType name="BoardType">
    <xs:sequence>
      <xs:group ref="BoardElementsGroup" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="vendor" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="revision" type="xs:string" use="optional" />
    <xs:attribute name="salesContact" type="xs:string" use="optional" />
    <xs:attribute name="orderForm" type="xs:anyURI" use="optional" />
  </xs:complexType>

  <xs:complexType name="BoardsType">
    <xs:sequence>
      <xs:element name="board" type="BoardType" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ExampleAttributesType">
    <xs:choice maxOccurs="unbounded">
      <xs:element name="category"  type="xs:string"             minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="component" type="ComponentCategoryType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="keyword"   type="xs:string"             minOccurs="0" maxOccurs="unbounded" />
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="ExampleType">
    <xs:sequence>
      <!-- brief example description -->
      <xs:element name="description" type="xs:string" />
      <!-- references the board -->
      <xs:element name="board" type="BoardReferenceType" maxOccurs="unbounded" />
      <!-- lists environments with their load files -->
      <xs:element name="project" type="ExampleProjectType" />
      <!-- categories, keywords and used components -->
      <xs:element name="attributes" type="ExampleAttributesType" />
    </xs:sequence>
    <!-- display name of the example -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- relative folder where the example is stored in the package -->
    <xs:attribute name="folder" type="xs:string" use="required" />
    <!-- archive file name with extension located in folder -->
    <xs:attribute name="archive" type="xs:string" use="optional" />
    <!-- file name with extension relative to folder -->
    <xs:attribute name="doc" type="xs:string" use="required" />
    <!-- version of the example -->
    <xs:attribute name="version" type="xs:string" use="optional" />
    <!-- if true, the vendor gives permission for the doc file being extracted from the pack and displayed on a web-page -->
    <!-- links to web pages are assumed public -->
    <xs:attribute name="public" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>

  <!-- section listing all examples contained in the package -->
  <xs:complexType name="ExamplesType">
    <xs:sequence>
      <xs:element name="example" type="ExampleType" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="KeywordsType">
    <xs:sequence>
      <xs:element name="keyword" type="xs:string" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="InstancesType">
    <xs:restriction base="xs:unsignedInt">
      <xs:minInclusive value="1" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Component file type definition -->
  <xs:complexType name="FileType">
    <xs:attribute name="condition" type="xs:string" use="optional" />
    <!-- file item category: source, header, include path, etc.  -->
    <xs:attribute name="category" type="FileCategoryType" use="required" />
    <!-- file item action attribute : config (copy to project, template, interface)  -->
    <xs:attribute name="attr" type="FileAttributeType" use="optional" />
    <!-- description for "template" or "interface" files. Multiple items are combined when they have the same select attribute  -->
    <xs:attribute name="select" type="xs:string" use="optional" />
    <!-- path + filename + extension -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- for category="header" path explicitly specifies the include path added to the commandline.-->
    <!-- Ignored for all other categories -->
    <xs:attribute name="path" type="xs:string" use="optional" />
    <!-- copy file to project folder:  deprecated, use attr="config" instead  -->
    <xs:attribute name="copy" type="xs:string" use="optional" />
    <!-- simple file version: to be used by RTE copy file action to see whether the file needs updating in project -->
    <xs:attribute name="version" type="ComponentVersionType" use="optional" />
    <!-- path(s) to find source files for a library, paths are delimited with semicolon (;) -->
    <xs:attribute name="src" type="xs:string" use="optional" />
    <!-- if true, the vendor gives permission for this file being extracted from the pack and displayed on a web-page -->
    <!-- links to web pages are assumed public -->
    <xs:attribute name="public" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>

  <!-- some strings are used to construct filenames (e.g. package name). Such names can contain only subset of characters 
       and must not contain neither spaces nor dots.
  -->
  <xs:simpleType name="RestrictedString">
    <xs:restriction base="xs:string">
      <xs:pattern value="[\-_A-Za-z0-9]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="RestrictedStringDname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[\-_A-Za-z0-9/]+" />
    </xs:restriction>
  </xs:simpleType>

  <!-- major.minor.patch -->
  <xs:simpleType name="SimpleVersionType">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]+\.[0-9]+((\.[0-9]+)|())" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ComponentVersionType">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]+\.[0-9]+((\.[0-9]+)|())((\-[0-9A-Za-z_\-\.]+)|([_A-Za-z][0-9A-Za-z_\-\.]*)|())((\+[\-\._A-Za-z0-9]+)|())" />
    </xs:restriction>
  </xs:simpleType>

  <!-- version can contain one or more of alphanumeric characters and symbols '_' '-' '.' 
       Important: version pattern shall remain the same while versions change
  -->
  <xs:simpleType name="PackVersionType">
    <xs:restriction base="xs:string">
      <!-- major . minor . patch [[-]quality] [+build] -->
      <xs:pattern value="[0-9]+.[0-9]+.[0-9]+((\-[0-9A-Za-z_\-\.]+)|([_A-Za-z][0-9A-Za-z_\-\.]*)|())((\+[\-\._A-Za-z0-9]+)|())" />
    </xs:restriction>
  </xs:simpleType>

  <!-- version can contain one or more of alphanumeric characters and symbols '_' '-' '.' 
       Allows specifing a version range: minVersion : maxVersion
  -->
  <xs:simpleType name="ConditionVersionType">
    <xs:restriction base="xs:string">
      <!-- <xs:pattern value="[\.:\-_A-Za-z0-9]+"/> -->
      <xs:pattern value="[0-9]+.[0-9]+((.[0-9]+)|())((\-[0-9A-Za-z_\-\.]+)|([_A-Za-z][0-9A-Za-z_\-\.]*)|())((\+[\-\._A-Za-z0-9]+)|())((:[0-9]+.[0-9]+((.[0-9]+)|()))|())((\-[0-9A-Za-z_\-\.]+)|([_A-Za-z][0-9A-Za-z_\-\.]*)|())((\+[\-\._A-Za-z0-9]+)|())" />
    </xs:restriction>
  </xs:simpleType>

  <!-- PackageType creates a unique ID for a package (added in 1.4.4) -->
  <xs:complexType name="PackageType">
    <!-- vendor of the package -->
    <xs:attribute name="vendor" type="xs:string" use="required" />
    <!-- name of the package -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- version or version range of the package -->
    <xs:attribute name="version" type="ConditionVersionType" use="optional" />
  </xs:complexType>

  <!-- Package dependency section type (added in 1.4.4) -->
  <xs:complexType name="PackagesType">
    <xs:sequence maxOccurs="unbounded">
      <xs:element name="package" type="PackageType" />
    </xs:sequence>
  </xs:complexType>

  <!-- LanguageType creates a unique language ID (added in 1.4.4) -->
  <xs:complexType name="LanguageType">
    <!-- language name e.g. C -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- language version e.g. C99 -->
    <xs:attribute name="version" type="xs:string" use="required" />
  </xs:complexType>

  <!-- Lanuage section type (added in 1.4.4) -->
  <xs:complexType name="LanguagesType">
    <xs:sequence maxOccurs="unbounded">
      <xs:element name="language" type="LanguageType" />
    </xs:sequence>
  </xs:complexType>

  <!-- CompilerType crates a unique toolchain ID, e.g. armcc 5.4.0 (added in 1.4.4) -->
  <xs:complexType name="CompilerType">
    <xs:attribute name="name" type="CompilerEnumType" use="required" />
    <xs:attribute name="version" type="xs:string" use="required" />
  </xs:complexType>

  <!-- Compiler section type (added in 1.4.4) -->
  <xs:complexType name="CompilersType">
    <xs:sequence maxOccurs="unbounded">
      <xs:element name="compiler" type="CompilerType" />
    </xs:sequence>
  </xs:complexType>

  <!-- Requirements Section: (added in 1.4.4) -->
  <xs:complexType name="RequirementsType">
    <xs:all>
      <xs:element name="packages" type="PackagesType" minOccurs="0" />
      <xs:element name="languages" type="LanguagesType" minOccurs="0" />
      <xs:element name="compilers" type="CompilersType" minOccurs="0" />
    </xs:all>
  </xs:complexType>

  <!-- release contains version as an attribute and notes as element text -->
  <xs:complexType name="ReleaseType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="version" type="PackVersionType" use="required" />
        <xs:attribute name="date" type="xs:date" use="optional" />
        <xs:attribute name="tag"         type="xs:string"       use="optional"/>
        <xs:attribute name="deprecated" type="xs:date" use="optional" />
        <xs:attribute name="replacement" type="xs:string" use="optional" />
        <xs:attribute name="url"         type="xs:anyURI"       use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="ReleasesType">
    <xs:sequence>
      <xs:element name="release" type="ReleaseType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!-- Generator file type definition -->
  <xs:complexType name="GeneratorFileType">
    <!-- conditions can be used to filter relevant files depending on e.g. device name 
         or toolchain -->
    <xs:attribute name="condition" type="xs:string" use="optional" />
    <!-- file item category: generator specific file type -->
    <xs:attribute name="category" type="xs:string" use="required" />
    <!-- path + filename + extension -->
    <xs:attribute name="name" type="xs:string" use="required" />
    <!-- file version -->
    <xs:attribute name="version" type="ComponentVersionType" use="optional" />
  </xs:complexType>

  <xs:complexType name="GeneratorDeviceSelectType">
    <xs:attribute name="Dvendor"  type="DeviceVendorEnum" use="required" />
    <xs:attribute name="Dname"    type="xs:string"        use="optional" />
    <xs:attribute name="Dvariant" type="xs:string"        use="optional" /> <!-- deprecated -->
    <xs:attribute name="Pname"    type="RestrictedString" use="optional" />
  </xs:complexType>

  <xs:simpleType name="HostEnumType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="all" />
      <xs:enumeration value="win" />
      <xs:enumeration value="linux" />
      <xs:enumeration value="mac" />
      <xs:enumeration value="other" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="WebGeneratorURLType">
    <xs:restriction base="xs:token">
      <xs:pattern value="http[s]{0,1}://[!-~]+" />
    </xs:restriction>
  </xs:simpleType>
  
  <!-- exe generator argument has optional host and switch attributes -->
  <xs:complexType name="ExeGeneratorArgumentType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="switch" type="xs:string" use="optional" />
        <xs:attribute name="host" type="HostEnumType" use="optional" default="all" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- web generator argument does not have host attribute -->
  <xs:complexType name="WebGeneratorArgumentType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <!-- web generator argument must have switch argument -->
        <xs:attribute name="switch" type="xs:string" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- eclipse generator argument does not have host nor switch attribute -->
  <xs:complexType name="EclipseGeneratorArgumentType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="GeneratorCommandType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="host" type="HostEnumType" use="optional" default="all" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="GeneratorCommandArgumentsType">
    <xs:sequence>
      <xs:element name="argument" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="switch" type="xs:string" use="optional" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="GpdscFileType">
    <xs:attribute name="name" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="ExeGeneratorType">
    <xs:sequence>
      <xs:element name="command" type="GeneratorCommandType" minOccurs="1" maxOccurs="4" />
      <xs:element name="argument" type="ExeGeneratorArgumentType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="host" type="HostEnumType" use="optional" default="all" />
  </xs:complexType>

  <xs:complexType name="WebGeneratorType">
    <xs:sequence>
      <xs:element name="argument" type="WebGeneratorArgumentType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="url" type="WebGeneratorURLType" use="required" />
  </xs:complexType>

  <xs:complexType name="EclipseGeneratorType">
    <xs:sequence>
      <xs:element name="argument" type="EclipseGeneratorArgumentType" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="plugin" type="xs:string" use="required" />
    <xs:attribute name="class" type="xs:string" use="required" />
    <xs:attribute name="method" type="xs:string" use="required" />
  </xs:complexType>


  <!-- Generator Type -->
  <xs:complexType name="GeneratorType">
    <xs:choice maxOccurs="unbounded">
      <!-- deprecated - use exe, web and/or eclipse -->
      <xs:element name="command" type="xs:string" minOccurs="0" />
      <!-- deprecated - use argument tags under exe, web and or eclipse-->
      <xs:element name="arguments" type="GeneratorCommandArgumentsType" minOccurs="0" />
      <xs:element name="description" type="xs:string" />
      <xs:element name="select" type="GeneratorDeviceSelectType" minOccurs="0" />
      <xs:element name="workingDir" type="xs:string" minOccurs="0" />
      <xs:element name="exe" type="ExeGeneratorType" minOccurs="0" maxOccurs="5" />
      <xs:element name="web" type="WebGeneratorType" minOccurs="0" />
      <xs:element name="eclipse" type="EclipseGeneratorType" minOccurs="0" />
      <xs:element name="gpdsc" type="GpdscFileType" minOccurs="0" />
      <!-- list of project files / content -->
      <xs:element name="project_files" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="file" type="FileType" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <!-- list of tool files / content -->
      <xs:element name="files" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <!-- tool files are under sole control of the generator -->
            <xs:element name="file" type="GeneratorFileType" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <!-- Generator tools specific section ignored by other tools -->
      <xs:element name="extensions" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded">
            </xs:any>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:choice>
    <xs:attribute name="id" type="xs:string" use="required" />
    <xs:attribute name="Gvendor" type="xs:string" use="optional" />
    <xs:attribute name="Gtool" type="xs:string" use="optional" />
    <xs:attribute name="Gversion" type="xs:string" use="optional" />
  </xs:complexType>

  <!-- Generators Section -->
  <xs:complexType name="GeneratorsType">
    <xs:sequence>
      <xs:element name="generator" type="GeneratorType" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="RepositoryType">
    <xs:simpleContent>
      <xs:extension base="xs:anyURI">
        <xs:attribute name="type" type="RepositoryTypeEnum" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="DominateType">
    <xs:attribute name="info" type="xs:string" use="required"/>
  </xs:complexType>
  
  <!-- package description root point -->
  <xs:element name="package" nillable="true">
    <xs:complexType>
      <xs:all>
        <!-- name of the package (Device Support=DFP, Board Support=BSP) -->
        <xs:element name="name" type="RestrictedString" minOccurs="1" />
        <!-- company name of the developer/maintainer of this package -->
        <xs:element name="vendor" type="RestrictedString" minOccurs="1" />
        <!-- brief description of the content and purpose of the package -->
        <xs:element name="description" type="xs:string" minOccurs="1" />
        <!-- download location of this PDSC and corresponding package file -->
        <xs:element name="url" type="xs:anyURI" minOccurs="1" />
        <!-- optional tag to override component versions from other packs -->
        <xs:element name="dominate" type="DominateType" minOccurs="0"/>
        <!-- optional: source repository of this pack -->
        <xs:element name="repository" type="RepositoryType" minOccurs="0"/>
        <!-- optional: e.g. mailto:Support@<vendor>.com or www.<vendor>.com/supportRequest -->
        <xs:element name="supportContact" type="xs:string" minOccurs="0" />
        <!-- optional: click through license file name and relative path -->
        <xs:element name="license" type="xs:string" minOccurs="0" />
        <!-- optional: section listing requirements (1.4.2) -->
        <xs:element name="requirements" type="RequirementsType" minOccurs="0" />
        <!-- Version numbers and release history -->
        <xs:element name="releases" type="ReleasesType" minOccurs="1" />
        <!-- keyword for Search Engine Indexing (e.g. Google) -->
        <xs:element name="keywords" type="KeywordsType" minOccurs="0" />
        <!-- generators are tools and utilities that are used to generate software components -->
        <xs:element name="generators" type="GeneratorsType" minOccurs="0" />
        <!-- definition of devices including references to device support files contained in package -->
        <xs:element name="devices" minOccurs="0">
          <xs:complexType>
            <!-- top level -->
            <xs:sequence>
              <!-- Family Level begin -->
              <xs:element name="family" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:group ref="DevicePropertiesGroup" />
                    <xs:element name="device" type="DeviceType" minOccurs="0" maxOccurs="unbounded" />
                    <!-- Sub Family Level begin-->
                    <xs:element name="subFamily" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:group ref="DevicePropertiesGroup" />
                          <!-- Device Level begin-->
                          <xs:element name="device" type="DeviceType" maxOccurs="unbounded" />
                          <!-- Device Level end -->
                        </xs:sequence>
                        <xs:attribute name="DsubFamily" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <!-- Sub Family Level end -->
                  </xs:sequence>
                  <xs:attribute name="Dfamily" type="xs:string" use="required" />
                  <xs:attribute name="Dvendor" type="DeviceVendorEnum" use="required" />
                </xs:complexType>
              </xs:element>
              <!-- Family Level end -->
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!-- devices end -->
        <!-- definition of boards. Can be referenced by examples -->
        <xs:element name="boards" type="BoardsType" minOccurs="0" />
        <!-- boards end -->
        <!-- taxonomy section contains default descriptions used in the entire model -->
        <xs:element name="taxonomy" type="TaxonomyType" minOccurs="0" />
        <!-- apis section contains api descriptions used in the entire model -->
        <xs:element name="apis" type="ApisType" minOccurs="0" />
        <!-- conditions section contains all condition entries used by any component of the package -->
        <xs:element name="conditions" type="ConditionsType" minOccurs="0" />
        <!-- examples section defining examples available within a package -->
        <xs:element name="examples" type="ExamplesType" minOccurs="0" />
        <!-- software component definition -->
        <xs:element name="components" minOccurs="0">
          <xs:complexType>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
              <!-- COMPONENT Description Root Point: -->
              <xs:element name="bundle" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="description" type="xs:string" />
                    <xs:element name="doc" type="xs:string" />
                    <xs:element name="component" minOccurs="1" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:all>
                          <!-- a component can be deprecated if it is no longer maintained-->
                          <xs:element name="deprecated" type="xs:boolean" minOccurs="0" default="false" />
                          <!-- short component description displayed -->
                          <xs:element name="description" type="xs:string" />
                          <!-- content to be added to generated RTE_Component.h file -->
                          <xs:element name="RTE_Components_h" type="xs:string" minOccurs="0" />
                          <!-- content to be added to generated Pre_Include_Global.h file -->
                          <xs:element name="Pre_Include_Global_h" type="xs:string" minOccurs="0" />
                          <!-- content to be added to generated Pre_Include_Local_<ComponentID>.h file -->
                          <xs:element name="Pre_Include_Local_Component_h" type="xs:string" minOccurs="0" />
                          <!-- list of files / content -->
                          <xs:element name="files">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="file" type="FileType" minOccurs="0" maxOccurs="unbounded" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:all>
                        <!-- component identity attributes Cclass Cvendor and Cversion are specified by bundle -->
                        <xs:attribute name="Cgroup" type="CgroupType" use="required" />
                        <xs:attribute name="Csub" type="CsubType" use="optional" />
                        <xs:attribute name="Cvariant" type="CvariantType" use="optional" />
                        <xs:attribute name="Cversion" type="ComponentVersionType" use="optional" />
                        <!-- api version for this component -->
                        <xs:attribute name="Capiversion" type="ComponentVersionType" use="optional" />
                        <!-- component attribute for referencing a condition specified in conditions section above -->
                        <xs:attribute name="condition" type="xs:string" use="optional" />
                        <!-- maximum allowed number of instances of a component in a project, default - 1-->
                        <xs:attribute name="maxInstances" type="InstancesType" use="optional" />
                        <!-- association of component with a generator. If the component is selected the generator information becomes active -->
                        <xs:attribute name="generator" type="xs:string" use="optional" />
                        <!-- identifies this component variant to be the preferred variant [Version 1.4.0] -->
                        <xs:attribute name="isDefaultVariant" type="xs:boolean" use="optional" />
                        <!-- identifies that this component requires custom implementation -->
                        <xs:attribute name="custom" type="xs:boolean" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <!-- bundle attributes -->
                  <xs:attribute name="Cbundle" type="xs:string" use="required" />
                  <xs:attribute name="Cvendor" type="xs:string" use="optional" />
                  <xs:attribute name="Cclass" type="CclassType" use="required" />
                  <xs:attribute name="Cversion" type="ComponentVersionType" use="required" />
                  <!-- association of component with a generator. If the component is selected the generator information becomes active -->
                  <xs:attribute name="generator" type="xs:string" use="optional" />
                  <!-- identifies this bundle variant to be the preferred variant [Version 1.4.0] -->
                  <xs:attribute name="isDefaultVariant" type="xs:boolean" use="optional" />
                </xs:complexType>
              </xs:element>
              <xs:element name="component" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:all>
                    <!-- a component can be deprecated if it is no longer maintained-->
                    <xs:element name="deprecated" type="xs:boolean" minOccurs="0" default="false" />
                    <!-- short component description displayed -->
                    <xs:element name="description" type="xs:string" />
                    <!-- content to be added to generated RTE_Component.h file -->
                    <xs:element name="RTE_Components_h" type="xs:string" minOccurs="0" />
                    <!-- content to be added to generated Pre_Include_Global.h file -->
                    <xs:element name="Pre_Include_Global_h" type="xs:string" minOccurs="0" />
                    <!-- content to be added to generated Pre_Include_Local_<ComponentID>.h file -->
                    <xs:element name="Pre_Include_Local_Component_h" type="xs:string" minOccurs="0" />
                    <!-- list of files / content -->
                    <xs:element name="files">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="file" type="FileType" maxOccurs="unbounded" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                  <!-- component identity attributes -->
                  <xs:attribute name="Cvendor" type="xs:string" use="optional" />
                  <xs:attribute name="Cclass" type="CclassType" use="required" />
                  <xs:attribute name="Cgroup" type="CgroupType" use="required" />
                  <xs:attribute name="Csub" type="CsubType" use="optional" />
                  <xs:attribute name="Cvariant" type="CvariantType" use="optional" />
                  <xs:attribute name="Cversion" type="ComponentVersionType" use="required" />
                  <!-- api version for this component -->
                  <xs:attribute name="Capiversion" type="ComponentVersionType" use="optional" />
                  <!-- component attribute for referencing a condition specified in conditions section above -->
                  <xs:attribute name="condition" type="xs:string" use="optional" />
                  <!-- maximum allowed number of instances of a component in a project, default - 1-->
                  <xs:attribute name="maxInstances" type="InstancesType" use="optional" />
                  <!-- association of component with a generator. If the component is selected the generator information becomes active -->
                  <xs:attribute name="generator" type="xs:string" use="optional" />
                  <!-- identifies this component variant to be the preferred variant [Version 1.4.0] -->
                  <xs:attribute name="isDefaultVariant" type="xs:boolean" use="optional" />
                  <!-- identifies that this component requires custom implementation -->
                  <xs:attribute name="custom" type="xs:boolean" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:choice>
            <xs:attribute name="generator" type="xs:string" use="optional" />
          </xs:complexType>
        </xs:element>
      </xs:all>
      <xs:attribute name="schemaVersion" type="SimpleVersionType" use="required" />
      <!-- optional package level filter attributes -->
      <xs:attribute name="Dvendor"       type="DeviceVendorEnum"  use="optional" />
      <xs:attribute name="Dname"         type="xs:string"         use="optional" />
      <xs:attribute name="Dcore"         type="DcoreEnum"         use="optional" />
      <xs:attribute name="Tcompiler"     type="CompilerEnumType"  use="optional" />
    </xs:complexType>
  </xs:element>
</xs:schema>
