Skip to content

Feature/add documentation#4

Merged
frisodebacker merged 6 commits into
developfrom
feature/add-documentation
May 22, 2026
Merged

Feature/add documentation#4
frisodebacker merged 6 commits into
developfrom
feature/add-documentation

Conversation

@frisodebacker
Copy link
Copy Markdown
Owner

No description provided.

Introduce a new peripheral generator for the SAMD21 GCLK module,
including documented register accessors, typed bitfield accessors,
and supporting enums (Generator, ClockSource, PeripheralClockID,
DivideSelection).

Refactor shared infrastructure extracted from the SERCOM generator
into central utilities and register/bitfield generators:
- Move swiftMemberIdentifier, swiftLowerCamelIdentifier,
  swiftUpperCamelIdentifier, and swiftReservedWords to Utils.swift
- Add generateSVDRegister() and generateSVDBitfieldAccessors()
  to RegisterGenerator.swift and BitfieldGenerator.swift

Enhance the documentation loader with scoped lookup keys
(e.g. "GCLK.CTRL") and enum value support, and add the new
GenericClockControllerGenerator to the registry and Xcode project.
Adds a PowerManagerGenerator that produces Swift register access for
the SAM D21 Power Manager peripheral, covering sleep modes, CPU/APB
clock prescalers, peripheral clock gate masks (AHB, APBA, APBB, APBC),
clock-ready interrupts, and reset-cause flag registers.

Introduces writeOneToClear write behavior in the bitfield generator so
that interrupt clear/set/flag registers only write on non-zero values,
avoiding accidental clearing of bits.

Also registers the generator in GeneratorRegistry and adds the
corresponding PM documentation data for ATSAMD21E18A.
…safeMutablePointer access

Remove the _volatileRegisterReadUInt32 and _volatileRegisterWriteUInt32 helper
functions in favor of direct UnsafeMutablePointer reads and writes. This
simplifies the generated register accessors by eliminating aligned-offset and
bit-shift computations that were previously needed to pack/unpack sub-32-bit
registers into 32-bit word accesses.

Apply the same change to the SERCOM peripheral's write-one-to-clear bitfield
setters for consistency.
Revert the shared register/bitfield generators back to _volatileRegister*
helper functions so that SERCOM, PowerManager, GCLK, and GPIO continue
using the aligned read-modify-write approach through volatile helpers.

Instead, add DMAC-proprietary register generation functions (dmacBuild*)
that use direct UnsafeMutablePointer<T> access per register width. This
keeps the shared generators clean while DMAC gets the direct pointer
approach.

Changes:
- RegisterGenerator.swift: restore aligned volatile access in getter/setter
  builders; make svdRegisterDocumentation/svdRegisterVariableName accessible
- SERCOM.swift: revert sercomBuildWriteOneToClearBitfieldSetter back to
  _volatileRegisterWriteUInt32
- DMAC.swift: add generateDMACRegister, dmacBuildRegisterGetter,
  dmacBuildRegisterSetter, dmacBuildDirectRegisterSetter; switch
  buildDMACFile to call generateDMACRegister
Provides documentation for navigating the HALGEN-ARM project,
including the architecture, how to add new peripheral generators,
the supplemental documentation system, build instructions, and
a full directory reference. Written for future contributors.
Copilot AI review requested due to automatic review settings May 22, 2026 13:14
@frisodebacker frisodebacker merged commit dd31a07 into develop May 22, 2026
1 check failed
@frisodebacker frisodebacker review requested due to automatic review settings May 22, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant