-
Notifications
You must be signed in to change notification settings - Fork 221
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
Change semantics of DMA futures #1835
Conversation
I agree, using INT_ENA to signal ready always felt a bit weird. Code looks good so far but I'd like to test things a bit. No idea what is wrong with CI |
This somehow breaks async-I2S-tx in a different way than what was fixed in #1833 |
Oh dear. I tested the async SPI and that worked. What hardware are you testing the I2S example with? Also I'm guessing it's the circular transfers that are the problem and not the one shot ones? Since those use different futures from the SPI driver. |
You can just run the example without anything attached and see it freezes while it was continuously pushing data before |
I2S TX is now working for me, thanks! I did some more testing and for PARL_IO_RX ( |
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.
LGTM - Thanks
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.
Apologies for the delay, this looks like a nice change, thanks!
Could you do a quick rebase on main and then we can merge this :)
Seems like this completely breaks SPI for me on
|
See #1857 |
* implement async for lcd_cam i8080 * lcd_cam: implement InterruptConfigurable for blocking and improve async * lcd_cam: use new async interrupt semantics from #1835 * lcd_cam: move interrupt handler binding into `new_async()` * lcd_cam: Instance::is_listening_lcd_done not used * i8080: no need for seperate `new_async()` * i8080: don't use DmaTxFuture, just test for dma error after complete * add HIL tests for LCD_CAM i8080 in blocking and async. * lcd_cam_i8080: test channels configured for async as well since teh compiler can't prevent it for now * fmt :-/ * lcd_cam fix comment * changelog * lcd_cam async: no need to enable interrupts until polled * lcd_cam: i8080 update for ReadBuffer changes
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
This PR is part of #1785, a small part that can be reviewed before the big PR comes in.
I've skipped changelog since this is an internal refactor.
The new semantics in this PR is also a proposal for how most (a handful are a little messy) interrupt based futures should work in the hal, so review this PR with that in mind as well.
The existing semantics of the DMA futures are:
The new semantics are:
Future
s do nothing unless polled)Poll::Pending
.The new semantics are meant to achieve two things.
Cancel safety is achieved by the fact that that the interrupt bits are not cleared unless
poll
returnsPoll::Ready(...)
. So if the future is dropped before (or even after) the interrupt fires, the interrupt bits are still there and can be consumed by some other part of the application if needed. The future can also be re-created if the application wants to try waiting again.Race conditions are eliminated by not using INT_ENA to check that the interrupt has fired but by instead checking INT_RAW. The existing semantics required you to create the future before starting the DMA, which ran the risk of bugs like #1728 . The new semantics in this PR let you create the future at any point, even after the transfer has started or even after it had finished.
Future enhancements include:
!Send
. Bad things can happen (before and after this PR) if the interrupt is executed on a different core to where the future is polled.Testing
I've tested this alongside other changes but not in isolation, I'll need to test this in isolation but it can still be reviewed before that.