Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32/spi: remove peripheral generic param. #2835

Merged
merged 3 commits into from
May 20, 2024
Merged

stm32/spi: remove peripheral generic param. #2835

merged 3 commits into from
May 20, 2024

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Apr 18, 2024

No description provided.

@Dirbaio Dirbaio marked this pull request as ready for review May 20, 2024 21:47
@Dirbaio Dirbaio enabled auto-merge May 20, 2024 21:48
@Dirbaio Dirbaio added this pull request to the merge queue May 20, 2024
Merged via the queue into main with commit 51d5530 May 20, 2024
6 checks passed
@Dirbaio Dirbaio deleted the spi-nogenerics branch May 20, 2024 21:55
@honzasp
Copy link
Contributor

honzasp commented May 23, 2024

Looking at the generated code for SealedRccPeripheral in _generated.rs, I found that we also maintain a global refcount in rcc::REFCOUNT_STOP1; if I understand correctly, this is used to find out whether we can enter low-power state:

    fn enable_and_reset_with_cs(_cs: critical_section::CriticalSection) {
        #[cfg(feature = "low-power")]
        unsafe {
            crate::rcc::REFCOUNT_STOP1 += 1
        };
        ...
    }
    fn disable_with_cs(_cs: critical_section::CriticalSection) {
        ...
        #[cfg(feature = "low-power")]
        unsafe {
            crate::rcc::REFCOUNT_STOP1 -= 1
        };
    }

It seems that the constructor of the SPI peripheral increments REFCOUNT_STOP1, but the destructor doesn't decrement it. Is that OK? If not, perhaps we can extend the ClockEnableBit structure to also increment/decrement the appropriate global refcount?

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.

None yet

2 participants