Skip to content

Fix clear-on-write fields that aren't actually clear-on-write #69

@9names

Description

@9names

I wrote this out in matrix a week ago. I've updated it to remove some inaccuracy, and am recording it here so we don't forget to fix it.

I've tested out using the Rust svdtools generated PAC - looks like we might need some changes around some registers.
Specifically, the SVD describes some fields as modifiedWriteValues: clear
from the SVD reference:
svd1
an example of one of these fields from the rp2040 reference manual
svd2

we were previously using .set_bit() on these fields, but in svd2rust this is removed for modifiedWriteValues: clear (since as far as it's concerned, any operation will clear the bit)

the accessor still has a .bit(value:bool) associated function, so we could change all of our calls on these frields from .set_bit() to .bit(true) and it should work for both old and new versions of the PAC

I feel like the SVD has probably got it wrong - at least in the case above. the write doesn't clear the bitfield. it sets the bit, and then you have to poll it until it's clear before moving on - it's a later hardware event that clears the bitfield.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamThis issue affects the upstream SVD file.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions