CMSIS-SVD: Enumerated Values Level

| CMSIS-SVD Version 1.3.1 CMSIS System View Description

- Main Page
- Usage and Description
- Reference

Enumerated Values Level
SVD File Schema Levels
Enumerated Values

The concept of enumerated values creates a map between unsigned integers and an identifier string. In addition, a description string can be associated with each entry in the map.

            0 <-> disabled -> "the clock source clk0 is turned off"
            1 <-> enabled  -> "the clock source clk1 is running"

This information is used for generating an enum in the device header file. The debugger may use this information to display the identifier string as well as the description. Just like symbolic constants making source code more readable, the system view in the debugger becomes more instructive. The detailed description can provide reference manual level details within the debugger.

    <enumeratedValues derivedFrom="xs:Name">

        <name>enumerationNameType</name>
        <usage>usageType</usage>

        <enumeratedValue>
            ...
        </enumeratedValue>

        ...
        <enumeratedValue>
            ...
        </enumeratedValue>

    </enumeratedValues>

Attribute Name | Description | Type | Occurrence
--- | --- | --- | ---
derivedFrom | Makes a copy from a previously defined enumeratedValues section. No modifications are allowed. An enumeratedValues entry is referenced by its name. If the name is not unique throughout the description, it needs to be further qualified by specifying the associated field, register, and peripheral as required. For example:
        field:                           clk.dis_en_enum
        register + field:                ctrl.clk.dis_en_enum
        peripheral + register + field:   timer0.ctrl.clk.dis_en_enum
| xs:Name | 0..1
Element Name | Description | Type | Occurrence
name | Identifier for the whole enumeration section. | xs:Name | 0..1
usage | Possible values are read, write, or read-write. This allows specifying two different enumerated values depending whether it is to be used for a read or a write access. If not specified, the default value read-write is used. | enumUsageType | 0..1
enumeratedValue | Describes a single entry in the enumeration. The number of required items depends on the bit width of the associated field. See section below for details. |  | 1..*

Enumerated Value

An enumeratedValue defines a map between an unsigned integer and a human readable string.

    <enumeratedValue>

        <name>identifierType</name>
        <description>xs:string</description>

        <choice>
            <value>scaledNonNegativeInteger</value>
            <isDefault>xs:boolean</isDefault>
        </choice>

    </enumeratedValue>

Element Name | Description | Type | Occurrence
--- | --- | --- | ---
name | String describing the semantics of the value. Can be displayed instead of the value. | identifierType | 0..1
description | Extended string describing the value. | xs:string | 0..1
choice of | 1..1
value | Defines the constant of the bit-field that the name corresponds to. | scaledNonNegativeInteger | 0..1
isDefault | Defines the name and description for all other values that are not listed explicitly. | xs:boolean | 0..1

# Example:

<enumeratedValues>
<name>TimerIntSelect</name>
<usage>read-write</usage>
<enumeratedValue>
<name>disabled</name>
<description>The clock source clk0 is turned off.</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>reserved</name>
<description>Reserved values. Do not use.</description>
<isDefault>true</isDefault>
</enumeratedValue>
</enumeratedValues>
<enumeratedValues>
<name>TimerIntSelect</name>
<usage>read-write</usage>
<enumeratedValue>
<name>disabled</name>
<description>Timer does not generate interrupts.</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>enabled</name>
<description>Timer generates interrupts.</description>
<isDefault>true</isDefault>
</enumeratedValue>
</enumeratedValues>