Skip to content

Add support for Access::WriteOnce registers #264

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

Merged
merged 1 commit into from
Jul 21, 2019

Conversation

hugwijst
Copy link

@hugwijst hugwijst commented Dec 3, 2018

Currently doesn't enforce the write-once nature of the registers, but
treats them as write-only.

Currently doesn't enforce the write-once nature of the registers, but
treats them as write-only.
@hugwijst hugwijst requested a review from a team as a code owner December 3, 2018 03:59
@Disasm
Copy link
Member

Disasm commented Feb 23, 2019

How is this WriteOnce property enforced?

} else if fields.iter().all(|f| f.access == Some(Access::WriteOnly)) {
} else if fields.iter().all(|f| f.access == Some(Access::WriteOnce)) {
Access::WriteOnce
} else if fields.iter().all(|f| f.access == Some(Access::WriteOnly) || f.access == Some(Access::WriteOnce)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this second f.access == Some(Access::WriteOnce) comparison is redundant

Copy link
Author

Choose a reason for hiding this comment

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

This checks that all the fields are either WriteOnly or WriteOnce, instead of only WriteOnly. A register that has both WriteOnly and WriteOnce fields is still WriteOnly and not ReadWrite.

Copy link
Member

Choose a reason for hiding this comment

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

A register that has both WriteOnly and WriteOnce fields is still WriteOnly and not ReadWrite.

Yes, but any register with both WriteOnly and WriteOnce will be processed by first WriteOnce if statement. The next if statement will process just WriteOnly registers. Or not?

@Disasm Disasm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Feb 23, 2019
@Disasm Disasm requested a review from therealprof February 23, 2019 08:03
@hugwijst
Copy link
Author

How is this WriteOnce property enforced?

It isn't, and I couldn't come up with a good way to enforce it on a type level :(

@Disasm
Copy link
Member

Disasm commented Feb 25, 2019

It isn't, and I couldn't come up with a good way to enforce it on a type level :(

Maybe write(self, ...) instead of write(&mut self, ...) will do what you need. Or something like write_once(self, ...).

@mathk
Copy link

mathk commented Mar 6, 2019

bors try

bors bot added a commit that referenced this pull request Mar 6, 2019
@bors
Copy link
Contributor

bors bot commented Mar 6, 2019

try

Build failed

@burrbull burrbull mentioned this pull request Jul 20, 2019
bors bot added a commit that referenced this pull request Jul 21, 2019
322: Once r=therealprof a=burrbull

r? @therealprof 

#264 was taken as base.

![изображение](https://user-images.githubusercontent.com/3072754/61576487-59a82280-aae3-11e9-9165-aefbf41b2925.png)


Co-authored-by: Hugo van der Wijst <[email protected]>
Co-authored-by: Andrey Zgarbul <[email protected]>
@bors bors bot merged commit 450b410 into rust-embedded:master Jul 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants