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

defmt-rtt: fix check for blocking RTT #579

Merged
merged 1 commit into from
Sep 15, 2021
Merged

defmt-rtt: fix check for blocking RTT #579

merged 1 commit into from
Sep 15, 2021

Conversation

jonas-schievink
Copy link
Contributor

This check wasn't testing correctly whether the BLOCK_IF_FULL bit was set, leading to knurling-rs/probe-run#257 breaking probe-run.

@@ -230,5 +230,5 @@ unsafe fn handle() -> &'static Channel {

fn host_is_connected(channel: &Channel) -> bool {
// we assume that a host is connected if we are in blocking-mode. this is what probe-run does.
channel.flags.load(Ordering::Relaxed) == BLOCK_IF_FULL
channel.flags.load(Ordering::Relaxed) & BLOCK_IF_FULL != 0
Copy link
Member

Choose a reason for hiding this comment

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

as the first 2 bits are a 3-state bitfield (0, 1 or 2). could you change this to load & mask == BLOCK_IF_FULL where mask = 0b11?

@japaric
Copy link
Member

japaric commented Sep 15, 2021

Thanks!

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 15, 2021

Build succeeded:

@bors bors bot merged commit fb85bc1 into knurling-rs:main Sep 15, 2021
@jonas-schievink jonas-schievink deleted the fix-check-for-blocking-rtt branch September 15, 2021 15:08
@Urhengulas Urhengulas mentioned this pull request Sep 15, 2021
5 tasks
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