Skip to content

Instantly share code, notes, and snippets.

@codebrainz
Created August 8, 2025 21:55
Show Gist options
  • Select an option

  • Save codebrainz/de3a3b89ec648eeb2ff894ea941ffb4f to your computer and use it in GitHub Desktop.

Select an option

Save codebrainz/de3a3b89ec648eeb2ff894ea941ffb4f to your computer and use it in GitHub Desktop.
Redacted delay
diff --git a/kernel/async.c b/kernel/async.c
index 8b37a2b..b113ab0 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -17,7 +17,7 @@ void delay(uint32_t ms) {
}
}
-#define WAIT_COND (*reg & expected_value) == expected_value
+#define WAIT_COND (((*reg) & (expected_value))) == (expected_value)
#define WAIT_CHECK (match > 0) ^ condition
bool wait(uint32_t *reg, uint32_t expected_value, bool match, uint32_t timeout){
@@ -25,7 +25,7 @@ bool wait(uint32_t *reg, uint32_t expected_value, bool match, uint32_t timeout){
while (WAIT_CHECK) {
if (timeout != 0){
timeout--;
- delay(1);
+ delay(0);
}
condition = WAIT_COND;
if (timeout == 0)
@@ -33,4 +33,4 @@ bool wait(uint32_t *reg, uint32_t expected_value, bool match, uint32_t timeout){
}
return true;
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment