Skip to content

implemented yield_wait_for#575

Open
addrian-77 wants to merge 7 commits intotock:masterfrom
WyliodrinEmbeddedIoT:add/yield_wait_for
Open

implemented yield_wait_for#575
addrian-77 wants to merge 7 commits intotock:masterfrom
WyliodrinEmbeddedIoT:add/yield_wait_for

Conversation

@addrian-77
Copy link
Copy Markdown

Added the function yield_wait_for, which returns after the wanted Syscall occurs, pushing back into the queue other Syscalls.
The function was tested inside buttons_wait_for.rs, called with Buttons::wait_for_button

@alexandruradovici
Copy link
Copy Markdown
Contributor

@addrian-77 can we move forward with this? Please fix the ci issues.

Signed-off-by: addrian-77 <lunguadrian30@gmail.com>
Signed-off-by: addrian-77 <lunguadrian30@gmail.com>

share::scope(|subscribe| {
// Subscribe to the button callback.
Buttons::register_listener(&listener, subscribe).unwrap();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yield-wait-for does not trigger the callback, it returns the arguments for the callback when yield-for-returns.

Comment thread platform/src/syscalls_impl.rs Outdated
}
}

fn yield_wait_for(driver_number: u32, subscribe_number: u32) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn yield_wait_for(driver_number: u32, subscribe_number: u32) {
fn yield_wait_for(driver_number: u32, subscribe_number: u32) -> (u32, u32, u32) {

yield-wait-for returns values instead of calling an upcall, all registers return. This is similar to yield-no-wait, but it only returns r1.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The first u32 is always 3, and the rest are driver_number and subscribe_number?

Signed-off-by: addrian-77 <lunguadrian30@gmail.com>
Comment thread apis/interface/buttons/src/lib.rs Outdated
}

// Wrapper for yield_wait_for
pub fn wait_for_button(driver_number: u32, subscribe_number: u32) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn wait_for_button(driver_number: u32, subscribe_number: u32) {
pub fn wait_for_button(driver_number: u32, subscribe_number: u32) -> (u32, ButtonState) {

@alexandruradovici
Copy link
Copy Markdown
Contributor

alexandruradovici commented Aug 5, 2025 via email

Signed-off-by: addrian-77 <lunguadrian30@gmail.com>
Comment thread apis/interface/buttons/src/lib.rs Outdated
"yield-wait-for called with no queueued upcall"
);
(r0, driver_number, subscribe_number)
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

In this unittest, this function basically returns the same thing everytime, is this okay? What should happen if we don't have the expected upcall?

Signed-off-by: addrian-77 <lunguadrian30@gmail.com>
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.

3 participants