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

riscv: add mcounteren in-memory update functions #217

Merged
merged 2 commits into from
May 28, 2024

Conversation

rmsyn
Copy link
Contributor

@rmsyn rmsyn commented May 25, 2024

Adds functions for updating the in-memory Mcounteren structure without touching the CSR.

Allows manipulating all bitfields in-memory, and writing the entire value back to the CSR at once.

rmsyn added 2 commits May 25, 2024 04:55
Uses the new `bf_extract` helper for the `mcounteren` register.
Adds functions for updating the in-memory `Mcounteren` structure without
touching the CSR.

Allows manipulating all bitfields in-memory, and writing the entire
value back to the CSR at once.
@rmsyn rmsyn requested a review from a team as a code owner May 25, 2024 05:19
Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

It would be interesting if we are able to update all the registers using brand new macros that follow this fashion.

@rmsyn
Copy link
Contributor Author

rmsyn commented May 25, 2024

It would be interesting if we are able to update all the registers using brand new macros that follow this fashion.

I can work on something. Would probably want at least two versions of the macro, read_only_csr and read_write_csr (or whatever naming scheme).

Might also be good to export the macros for downstream users with custom CSRs on their SoC.

@romancardenas romancardenas added this pull request to the merge queue May 28, 2024
Merged via the queue into rust-embedded:master with commit 7291ac2 May 28, 2024
95 checks passed
@rmsyn rmsyn deleted the riscv/mcounteren-in-mem branch May 29, 2024 02:22
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.

2 participants