ifgen.svd.group package — docs

Skip to main content
`Ctrl`+`K`

# ifgen.svd.group package

## Submodules

## ifgen.svd.group.base module

A module implementing base interfaces for processing a group of peripherals.

class ifgen.svd.group.base.PeripheralGroup(root: Peripheral, derivatives: list[Peripheral])

  Bases: `object`

  A container for peripherals that have the same register layout.

  derivatives: list[Peripheral]
  property peripherals: Iterator[Peripheral]

    Get all peripheral instances.

  root: Peripheral

ifgen.svd.group.base.get_derived(peripheral: Peripheral, peripherals: list[Peripheral]) → Peripheral | None

  Determine if this peripheral is derived from any other peripheral.

ifgen.svd.group.base.peripheral_groups(peripherals: dict[str, Peripheral]) → dict[str, PeripheralGroup]

  Organize peripherals into groups.

## ifgen.svd.group.enums module

A module for handling SVD bit-field enumerations.

ifgen.svd.group.enums.as_alnum(word: str) → str

  Get a word’s alpha-numeric contents only.

ifgen.svd.group.enums.get_enum_name(name: str, peripheral: str, raw_mapping: dict[str, Any]) → str

  Get the name of an enumeration.

ifgen.svd.group.enums.handle_duplicate(existing: dict[str, Any], key: str, value: Any) → None

  Handle key de-duplication for enumerations.

ifgen.svd.group.enums.handle_enum_name(name: str, description: str = None) → str

  Attempt to generate more useful enumeration names.

ifgen.svd.group.enums.is_name_part(value: str) → bool

  Determine if a word should be part of an enumeration value name.

ifgen.svd.group.enums.remove_common_prefixes(data: dict[str, Any]) → dict[str, Any]

  Attempt to remove common prefixes in enumeration names.

ifgen.svd.group.enums.translate_enums(enum: EnumeratedValues) → dict[str, Any]

  Generate an enumeration definition.

## ifgen.svd.group.fields module

A module for generating configuration data for struct fields.

ifgen.svd.group.fields.check_not_handled_fields(data: dict[str, Any], fields: Iterable[str]) → None

  Ensure that some keys aren’t present in data.

ifgen.svd.group.fields.handle_cluster(cluster: Cluster, structs: dict[str, Any], enums: dict[str, Any], peripheral: str, min_enum_members: int) → tuple[int, dict[str, Any]]

  Handle a cluster element.

ifgen.svd.group.fields.handle_item(item: Register | Cluster, structs: dict[str, Any], enums: dict[str, Any], peripheral: str, min_enum_width: int, groups_handled: set[str], register_map: dict[str, Register], groups: dict[str, list[Register]], by_name: dict[str, str]) → tuple[int, dict[str, Any] | None]

  Handle creating a struct field from a register or cluster.

ifgen.svd.group.fields.handle_register(register: Register, register_map: dict[str, Register], enums: dict[str, Any], peripheral: str, min_enum_width: int) → tuple[int, dict[str, Any]]

  Handle a register entry.

ifgen.svd.group.fields.handle_register_group(name: str, registers: list[Register], register_map: dict[str, Register], enums: dict[str, Any], peripheral: str, min_enum_width: int) → tuple[int, dict[str, Any]]

  Handle creating a struct field for a group of registers.

ifgen.svd.group.fields.parse_offset(data: dict[str, str]) → int

  Parse a hex string to get decimal address offset.

ifgen.svd.group.fields.process_bit_fields(register: Register, output: dict[str, Any], enums: dict[str, Any], peripheral: str, min_enum_width: int) → None

  Get bit-field declarations for a given register.

ifgen.svd.group.fields.sanitize_name(name: str) → str

  Remove special characters from a name.

ifgen.svd.group.fields.struct_fields(registers: list[Register | Cluster], structs: dict[str, Any], enums: dict[str, Any], peripheral: str, min_enum_width: int, size: int = None) → tuple[int, list[dict[str, Any]]]

  Generate data for struct fields.

## Module contents

A module implementing interfaces for processing a group of peripherals.

class ifgen.svd.group.PeripheralGroup(root: Peripheral, derivatives: list[Peripheral])

  Bases: `object`

  A container for peripherals that have the same register layout.

  derivatives: list[Peripheral]
  property peripherals: Iterator[Peripheral]

    Get all peripheral instances.

  root: Peripheral

ifgen.svd.group.handle_group(output_dir: Path, group: PeripheralGroup, includes: set[Path], min_enum_members: int) → None

  Handle a peripheral group.

ifgen.svd.group.peripheral_groups(peripherals: dict[str, Peripheral]) → dict[str, PeripheralGroup]

  Organize peripherals into groups.