CMSIS-SVD
Version 1.3.3
CMSIS System View Description
|
All registers of a peripheral are enclosed between the <registers> opening and closing tags. Clusters define a set of registers. You can either use the <cluster> or the <register> element.
Example:
/device/peripherals/peripheral/registers
Parent Element | Element Chain | ||
---|---|---|---|
peripheral | /device/peripherals/peripheral element | ||
Child Elements | Description | Type | Occurrence |
cluster | Define the sequence of register clusters. | clusterType | 0..* |
register | Define the sequence of registers. | registerType | 1..* |
Cluster describes a sequence of neighboring registers within a peripheral. A <cluster> specifies the addressOffset relative to the baseAddress of the grouping element. All <register> elements within a <cluster> specify their addressOffset relative to the cluster base address (<peripheral.baseAddress> + <cluster.addressOffset>).
Multiple <register> and <cluster> sections may occur in any order. Since version 1.3 of the specification, the nesting of <cluster> elements is supported. Nested clusters express hierarchical structures of registers. It is predominantely targeted at the generation of device header files to create a C-data structure within the peripheral structure instead of a flat list of registers. Note, you can also specify an array of a cluster using the <dim> element.
/device/pripherals/peripheral/registers/.../cluster
Parent Element | Element Chain | ||
---|---|---|---|
registers | /device/peripherals/peripheral/registers element | ||
cluster | /device/pripherals/peripheral/registers/.../cluster element | ||
Attributes | Description | Type | Occurrence |
derivedFrom | Specify the cluster name from which to inherit data. Elements specified subsequently override inherited values. Usage:
| registerType | 0..1 |
Child Elements | Description | Type | Occurrence |
Refer to dimElementGroup for details. | |||
dim | Define the number of elements in an array of clusters. | scaledNonNegativeInteger | 1..1 |
dimIncrement | Specify the address increment, in Bytes, between two neighboring clusters of the cluster array. | scaledNonNegativeInteger | 1..1 |
dimIndex | Specify the strings that substitute the placeholder [%s] within the cluster <name>. Use the placeholder %s in <name> when <dimIndex> is specified. | dimIndexType | 0..1 |
dimName | Specify the name of the C-type structure. If not defined, then the entry of the <name> element is used. | identifierType | 0..1 |
dimArrayIndex | Grouping element to create enumerations in the header file. | dimArrayIndexType | 0..1 |
name | String to identify the cluster. Cluster names are required to be unique within the scope of a peripheral. A list of cluster names can be build using the placeholder %s. Use the placeholder [%s] at the end of the identifier to generate arrays in the header file. The placeholder [%s] cannot be used together with <dimIndex>. | dimableIdentifierType | 1..1 |
description | String describing the details of the register cluster. | xs:string | 0..1 |
alternateCluster | Specify the name of the original cluster if this cluster provides an alternative description. | dimableIdentifierType | 0..1 |
headerStructName | Specify the struct type name created in the device header file. If not specified, then the name of the cluster is used. | identifierType | 0..1 |
addressOffset | Cluster address relative to the <baseAddress> of the peripheral. | scaledNonNegativeInteger | 1..1 |
Refer to registerPropertiesGroup for details. | |||
size | Define the default bit-width of any device register (implicit inheritance). | scaledNonNegativeInteger | 0..1 |
access | Define access rights. | accessType | 0..1 |
protection | Specify the security privilege to access an address region. | protectionStringType | 0..1 |
resetValue | Define the default value for all registers at RESET. | scaledNonNegativeInteger | 0..1 |
resetMask | Identify register bits that have a defined reset value. | scaledNonNegativeInteger | 0..1 |
register | Define a sequence of register within a cluster. | registerType | 0..* |
cluster | Element to nest cluster definitions. | clusterType | 0..* |
The description of registers is the most essential part of SVD. If the elements <size>, <access>, <resetValue>, and <resetMask> have not been specified on a higher level, then these elements are mandatory on register level.
A register can represent a single value or can be subdivided into individual bit-fields of specific functionality and semantics. From a schema perspective, the element <fields> is optional, however, from a specification perspective, <fields> are mandatory when they are described in the device documentation.
You can define register arrays where the single description gets duplicated automatically. The size of the array is specified by the <dim> element. Register names get composed by the element <name> and the index-specific string defined in <dimIndex>. The element <dimIncrement> specifies the address offset between two registers.
Example:
This example describes two registers, TimerCtrl0 and TimerCtrl1. The values defined for TimerCtrl0 are inherited by the derived register TimerCtrl1, except for the value in <addressOffset>.
Example:
This example describes two registers, TIM_MODEA and TIM_MODEB. Both have the same address offset. Based on the configured operation model being A or B, the register acts as reload or compare value. The register DMA_DATA is specified as a pointer to unsigned word data. The code generated for the device header file is:
/device/peripherals/peripheral/registers/.../register
Parent Element | Element Chain | ||
---|---|---|---|
cluster | /device/pripherals/peripheral/registers/.../cluster element | ||
registers | /device/peripherals/peripheral/registers element | ||
Attributes | Description | Type | Occurrence |
derivedFrom | Specify the register name from which to inherit data. Elements specified subsequently override inherited values. Usage:
| xs:Name | 0..1 |
Child Elements | Description | Type | Occurrence |
Refer to dimElementGroup for details. | |||
dim | Define the number of elements in an array of registers. If <dimIncrement> is specified, this element becomes mandatory. | scaledNonNegativeInteger | 1..1 |
dimIncrement | Specify the address increment, in Bytes, between two neighboring registers. | scaledNonNegativeInteger | 1..1 |
dimIndex | Specify the substrings that replaces the %s placeholder within name and displayName. By default, the index is a decimal value starting with 0 for the first register. dimIndex should not be used together with the placeholder [%s], but rather with %s. | dimIndexType | 0..1 |
dimName | Specify the name of the C-type structure. If not defined, then the entry of the <name> element is used. | identifyerType | 0..1 |
dimArrayIndex | Grouping element to create enumerations in the header file. | dimArrayIndexType | 0..1 |
name | String to identify the register. Register names are required to be unique within the scope of a peripheral. You can use the placeholder %s, which is replaced by the dimIndex substring. Use the placeholder [%s] only at the end of the identifier to generate arrays in the header file. The placeholder [%s] cannot be used together with dimIndex. | registerNameType | 1..1 |
displayName | When specified, then this string can be used by a graphical frontend to visualize the register. Otherwise the name element is displayed. displayName may contain special characters and white spaces. You can use the placeholder %s, which is replaced by the dimIndex substring. Use the placeholder [%s] only at the end of the identifier. The placeholder [%s] cannot be used together with dimIndex. | xs:string | 0..1 |
description | String describing the details of the register. | xs:string | 0..1 |
alternateGroup | Specifies a group name associated with all alternate register that have the same name. At the same time, it indicates that there is a register definition allocating the same absolute address in the address space. | xs:Name | 0..1 |
alternateRegister | This tag can reference a register that has been defined above to current location in the description and that describes the memory location already. This tells the SVDConv's address checker that the redefinition of this particular register is intentional. The register name needs to be unique within the scope of the current peripheral. A register description is defined either for a unique address location or could be a redefinition of an already described address. In the latter case, the register can be either marked alternateRegister and needs to have a unique name, or it can have the same register name but is assigned to a register subgroup through the tag alternateGroup (specified in version 1.0). | identifierType | 0..1 |
addressOffset | Define the address offset relative to the enclosing element. | scaledNonNegativeInteger | 1..1 |
Refer to registerPropertiesGroup for details about the colored elements. | |||
size | Defines the default bit-width of any register contained in the device (implicit inheritance). | scaledNonNegativeInteger | 0..1 |
access | Defines the default access rights for all registers. | accessType | 0..1 |
protection | Defines the protection rights for all registers. | protectionStringType | 0..1 |
resetValue | Defines the default value for all registers at RESET. | scaledNonNegativeInteger | 0..1 |
resetMask | Identifies which register bits have a defined reset value. | scaledNonNegativeInteger | 0..1 |
dataType | It can be useful to assign a specific native C datatype to a register. This helps avoiding type casts. For example, if a 32 bit register shall act as a pointer to a 32 bit unsigned data item, then dataType can be set to "uint32_t *". The following simple data types are predefined:
| dataTypeType | 0..1 |
modifiedWriteValues | Element to describe the manipulation of data written to a register. If not specified, the value written to the field is the value stored in the field. The other options define bitwise operations:
| modifiedWriteValuesType | 0..1 |
writeConstraint | Three mutually exclusive options exist to set write-constraints. | writeConstraintType | 0..1 |
readAction | If set, it specifies the side effect following a read operation. If not set, the register is not modified. The defined side effects are:
| readActionType | 0..1 |
fields | In case a register is subdivided into bit fields, it should be reflected in the SVD description file to create bit-access macros and bit-field structures in the header file. | fieldsType | 0..1 |
Define constraints for writing values to a field. You can choose between three options, which are mutualy exclusive.
Example:
The example shows write constraints defined on different levels. The write constrains on <register> level are propagated as default to all subsequent fields, especially to field F_N. Field F_ONE overwrites the default and sets the write range between 2..4. Other values cannot be written to this field. Field F_TWO overwrites the default and allows to write only the last read value.
/device/peripherals/peripheral/registers/.../register/.../writeConstraint
Parent Element | Element Chain | ||
---|---|---|---|
register | /device/peripherals/peripheral/registers/.../register element | ||
field | /device/peripherals/peripheral/registers/.../fields/field element | ||
Child Elements | Description | Type | Occurrence |
writeAsRead | If true, only the last read value can be written. | xs:boolean | 0..1 |
useEnumeratedValues | If true, only the values listed in the enumeratedValues list can be written. | xs:boolean | 0..1 |
range | Contains the following two elements: | 0..1 | |
minimum | Specify the smallest number to be written to the field. | scaledNonNegativeInteger | 1..1 |
maximum | Specify the largest number to be written to the field. | scaledNonNegativeInteger | 1..1 |
Grouping element to define bit-field properties of a register.
Example:
The example creates two bit-files TimerCtrl0_IntSel and BIT1. The bit-field TimerCtrl0_IntSel has an bit offset of 1 and a depth of 3 bits, with unrestricted read and write access, a reset value of 0 and a write constraint of oneToSet, which means that only the written bit is changed. The value allowed to be written to the field range between 0-5. After a read operation, all bits are set to zero.
The bit-field BIT1, described as a test field, has the size of 8 bits and can be unlimited read and written.
/device/peripherals/peripheral/registers/.../register/fields
Parent Element | Element Chain | ||
---|---|---|---|
register | /device/peripherals/peripheral/registers/.../register element | ||
Child Elements | Description | Type | Occurrence |
field | Define the bit-field properties of a register. | fieldType | 1..* |
All fields of a register are enclosed between the <fields> opening and closing tags.
A bit-field has a name that is unique within the register. The position and size within the register can be decsribed in two ways:
A field may define an enumeratedValue in order to make the display more intuitive to read.
/device/peripherals/peripheral/registers/.../fields/field
Parent Element | Element Chain | ||
---|---|---|---|
fields | /device/peripherals/peripheral/registers/.../register/fields element | ||
Attributes | Description | Type | Occurrence |
derivedFrom | Specify the field name from which to inherit data. Elements specified subsequently override inherited values. Usage:
| xs:Name | 0..1 |
Child Elements | Description | Type | Occurrence |
Refer to dimElementGroup for details. | |||
dim | Defines the number of elements in a list. | scaledNonNegativeInteger | 1..1 |
dimIncrement | Specify the address increment, in bits, between two neighboring list members in the address map. | scaledNonNegativeInteger | 1..1 |
dimIndex | Specify the strings that substitue the placeholder %s within <name> and <displayName>. | dimIndexType | 0..1 |
dimName | Specify the name of the C-type structure. If not defined, then the entry in the <name> element is used. | identifierType | 0..1 |
dimArrayIndex | Grouping element to create enumerations in the header file. | dimArrayIndexType | 0..1 |
name | Name string used to identify the field. Field names must be unique within a register. | dimableIdentifierType | 1..1 |
description | String describing the details of the register. | stringType | 0..1 |
Choice of | Three mutually exclusive options exist to describe the bit-range: | 1..1 | |
1. bitRangeLsbMsbStyle | |||
bitOffset | Value defining the position of the least significant bit of the field within the register. | scaledNonNegativeInteger | 1..1 |
bitWidth | Value defining the bit-width of the bitfield within the register. | scaledNonNegativeInteger | 0..1 |
2. bitRangeOffsetWidthStyle | |||
lsb | Value defining the bit position of the least significant bit within the register. | scaledNonNegativeInteger | 1..1 |
msb | Value defining the bit position of the most significant bit within the register. | scaledNonNegativeInteger | 1..1 |
3. bitRangePattern | |||
bitRange | A string in the format: "[<msb>:<lsb>]" | bitRangeType | 0..1 |
access | Predefined strings set the access type. The element can be omitted if access rights get inherited from parent elements. | accessType | 0..1 |
modifiedWriteValues | Describe the manipulation of data written to a field. If not specified, the value written to the field is the value stored in the field. The other options are bitwise operations:
| modifiedWriteValuesType | 0..1 |
writeConstraint | Three mutually exclusive options exist to set write-constraints. | writeConstraintType | 0..1 |
readAction | If set, it specifies the side effect following a read operation. If not set, the field is not modified after a read. The defined side effects are:
| readActionType | 0..1 register |
enumeratedValues | Next lower level of description. | enumerationType | 0..2 |
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." 2 <-> reserved -> "Reserved values. Do not use."
This information generates 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.
Example:
/device/peripherals/peripheral/registers/.../field/enumeratedValues
Parent Element | Element Chain | ||
---|---|---|---|
field | /device/peripherals/peripheral/registers/.../fields/field element | ||
Attributes | 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 |
Child Elements | Description | Type | Occurrence |
name | Identifier for the whole enumeration section. | xs:Name | 0..1 |
headerEnumName | Identifier for the enumeration section. Overwrites the hierarchical enumeration type in the device header file. User is responsible for uniqueness across description. | identifierType | 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. | enumeratedValueType | 1..* |
An enumeratedValue defines a map between an unsigned integer and a string.
/device/peripherals/peripheral/registers/.../enumeratedValue
Parent Element | Element Chain | ||
---|---|---|---|
enumeratedValues | /device/peripherals/peripheral/registers/.../field/enumeratedValues element | ||
dimArrayIndex | /device/peripherals/peripheral/.../dimArrayIndex element | ||
Child Elements | 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 for the bit-field. The field accepts 'do not care' bits represented by x. | scaledNonNegativeInteger | 0..1 |
isDefault | Defines the name and description for all other values that are not listed explicitly. | xs:boolean | 0..1 |