-
Notifications
You must be signed in to change notification settings - Fork 121
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
Fixup rosc_set_div function #15
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,13 @@ uint rosc_find_freq(uint32_t low_mhz, uint32_t high_mhz) { | |
} | ||
|
||
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); | ||
rosc_clear_bad_write(); | ||
assert(rosc_write_okay()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. under what circumstances can this fail? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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) |
||
// don't use rosc_write here because setting a valid DIV is incorrectly flagged as a bad write | ||
rosc_hw->div = ROSC_DIV_VALUE_PASS + div; | ||
rosc_clear_bad_write(); | ||
assert(rosc_write_okay()); | ||
} | ||
|
||
void rosc_set_freq(uint32_t code) { | ||
|
@@ -58,4 +63,4 @@ void rosc_set_dormant(void) { | |
rosc_write(&rosc_hw->dormant, ROSC_DORMANT_VALUE_DORMANT); | ||
// Wait for it to become stable once woken up | ||
while(!(rosc_hw->status & ROSC_STATUS_STABLE_BITS)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this should actually be a
valid_params_if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll update it this evening.