Skip to content

Conversation

addrian-77
Copy link

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
Contributor

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


share::scope(|subscribe| {
// Subscribe to the button callback.
Buttons::register_listener(&listener, subscribe).unwrap();
Copy link
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.

}
}

fn yield_wait_for(driver_number: u32, subscribe_number: u32) {
Copy link
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
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?

}

// Wrapper for yield_wait_for
pub fn wait_for_button(driver_number: u32, subscribe_number: u32) {
Copy link
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
Contributor

alexandruradovici commented Aug 5, 2025 via email

"yield-wait-for called with no queueued upcall"
);
(r0, driver_number, subscribe_number)
}
Copy link
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?

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