Open
Conversation
Writing ROSC DIV incorrectly sets BADWRITE, so avoid rosc_write and manually clear the BADWRITE bit
kilograham
requested changes
Jun 2, 2021
| void rosc_set_div(uint32_t div) { | ||
| assert(div <= 31 && div >= 1); | ||
| rosc_write(&rosc_hw->div, ROSC_DIV_VALUE_PASS + div); | ||
| assert(div <= 31); |
Contributor
There was a problem hiding this comment.
seems like this should actually be a valid_params_if
Contributor
Author
There was a problem hiding this comment.
Good point, I'll update it this evening.
| rosc_write(&rosc_hw->div, ROSC_DIV_VALUE_PASS + div); | ||
| assert(div <= 31); | ||
| rosc_clear_bad_write(); | ||
| assert(rosc_write_okay()); |
Contributor
There was a problem hiding this comment.
under what circumstances can this fail?
Contributor
Author
There was a problem hiding this comment.
Well that's a good question - it's so long since I wrote this PR that I can't remember now! I'll have to dig through my emails this evening....... (and hope that the answer exists in an email and isn't lost somewhere in the google chat history)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A ROSC DIV of 0 is okay (and sets DIV = 32)
Writing ROSC DIV incorrectly sets BADWRITE, so avoid rosc_write and manually clear the BADWRITE bit