ifgen.svd.model package

Contents

ifgen.svd.model package#

Submodules#

ifgen.svd.model.address_block module#

A module implementing a data model for ARM CMSIS-SVD ‘addressBlock’ data.

class ifgen.svd.model.address_block.AddressBlock[source]#

Bases: StringKeyValueMixin

A container for address-block information.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.cpu module#

A module implementing a data model for ARM CMSIS-SVD ‘cpu’ data.

class ifgen.svd.model.cpu.Cpu[source]#

Bases: StringKeyValueMixin

A container for cpu information.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.derived module#

A module implementing a class mixin for SVD element types with a derivedFrom attribute.

class ifgen.svd.model.derived.DerivedMixin[source]#

Bases: StringKeyValueMixin

A class mixin for instances with a derived attribute.

alternate(key: str = 'alternateRegister') str | None[source]#

Get a possible alternate for this instance.

property alternates: list[T]#

Get alternates of this instance.

property derived: bool#

Whether or not this peripheral is derived from another.

property derived_elem: T#

Get the derived element.

is_alternate(key: str = 'alternateRegister') bool[source]#

Determine if this instance is an alternate of another.

log(elem: Element, logger: Logger | LoggerAdapter[Any] | None) None[source]#

Log information from this instance’s raw data.

property name: str#

Get the name of this peripheral.

ifgen.svd.model.derived.derived_from_stack(elements: Iterable[Element]) Iterator[Element][source]#

Organize elements that are derived after ones that aren’t.

ifgen.svd.model.device module#

A module implementing a data model for ARM CMSIS-SVD ‘device’ data.

class ifgen.svd.model.device.Device[source]#

Bases: StringKeyValueMixin

A container for device information.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.enum module#

A module implementing a data model for ARM CMSIS-SVD ‘enumeratedValue’ data.

class ifgen.svd.model.enum.EnumeratedValue[source]#

Bases: StringKeyValueMixin

A container for enumerated-value information.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

class ifgen.svd.model.enum.EnumeratedValues(derived_from: EnumeratedValues | None, enum: dict[str, EnumeratedValue])[source]#

Bases: DerivedMixin

A container for enum information.

derived_from: EnumeratedValues | None#
enum: dict[str, EnumeratedValue]#
classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.enum.get_enum(enumerated_values: Element) EnumeratedValues[source]#

Get register clusters.

ifgen.svd.model.field module#

A module implementing a data model for ARM CMSIS-SVD ‘field’ data.

class ifgen.svd.model.field.Field(derived_from: Field | None, enum: EnumeratedValues | None)[source]#

Bases: DerivedMixin

A container for field information.

property access: str#

Get this instance’s access property.

derived_from: Field | None#
enum: EnumeratedValues | None#
property ifgen_data: dict[str, Any]#

Populate bit-field data.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.field.get_fields(registers: Element) dict[str, Field][source]#

Get register fields.

ifgen.svd.model.interrupt module#

A module implementing a data model for ARM CMSIS-SVD ‘interrupt’ data.

class ifgen.svd.model.interrupt.Interrupt[source]#

Bases: StringKeyValueMixin

A container for interrupt information.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.peripheral module#

A module implementing a data model for ARM CMSIS-SVD ‘peripheral’ data.

class ifgen.svd.model.peripheral.Cluster(derived_from: Cluster | None, children: list[Register | Cluster], peripheral: Peripheral)[source]#

Bases: DerivedMixin

A container for cluster information.

children: list[Register | Cluster]#
derived_from: Cluster | None#
peripheral: Peripheral#
classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

class ifgen.svd.model.peripheral.Peripheral(derived_from: Peripheral | None, interrupts: List[Interrupt], address_blocks: List[AddressBlock], registers: list[Register | Cluster])[source]#

Bases: DerivedMixin

A container for peripheral information.

property access: str | None#

Get the possible ‘access’ field default.

address_blocks: List[AddressBlock]#
base_name(lower: bool = True) str[source]#

Get the base peripheral name.

property bits: int | None#

Get size for this peripheral in bits.

derived_from: Peripheral | None#
handle_address_block(address_block: Element) None[source]#

Handle an ‘address_block’ element.

handle_interrupt(interrupt: Element) None[source]#

Handle an ‘interrupt’ element.

interrupts: List[Interrupt]#
register_groups() dict[str, list[Register]][source]#

Get register groups.

registers: list[Register | Cluster]#
classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

class ifgen.svd.model.peripheral.Register(derived_from: Register | None, fields: dict[str, Field] | None, peripheral: Peripheral)[source]#

Bases: DerivedMixin

A container for register information.

property access: str#

Get the access setting for this register.

property alternate_group: str | None#

Get this register’s possible alternate group.

property bits: int#

Get the size of this register in bits.

property c_type: str#

Get the C type for this register.

derived_from: Register | None#
fields: dict[str, Field] | None#
peripheral: Peripheral#
property size: int#

Get the size of this register in bytes.

classmethod string_keys() Iterable[StringKeyVal][source]#

Get string keys for this instance type.

ifgen.svd.model.peripheral.fields_equal(left: dict[str, Field] | None, right: dict[str, Field] | None) bool[source]#

Determine if two field maps are equivalent.

ifgen.svd.model.peripheral.register_groups(registers: list[Register | Cluster]) dict[str, list[Register]][source]#

Get groups of registers.

Module contents#

A module implementing a data model for ARM CMSIS-SVD ‘device’ data.

class ifgen.svd.model.SvdModel(peripherals: dict[str, Peripheral], device: Device | None = None, cpu: Cpu | None = None)[source]#

Bases: object

A model for SVD data.

assign_cpu(cpu: Cpu) None[source]#

Assign a cpu instance.

assign_device(device: Device) None[source]#

Assign a device instance.

cpu: Cpu | None = None#
device: Device | None = None#
property device_name: str#

Get the SVD device name.

metadata() dict[str, Any][source]#

Get device and CPU metadata.

namespace() list[str][source]#

Get a namespace for this SVD device.

peripherals: dict[str, Peripheral]#
register_peripheral(elem: Element, peripheral: Peripheral) None[source]#

Register a peripheral.