-
Notifications
You must be signed in to change notification settings - Fork 1.2k
embassy-rp: new DMA driver #4622
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
base: main
Are you sure you want to change the base?
Conversation
971a61c
to
a3ea9e0
Compare
Tangentially related, but it would be cool to add support for PIO to PIO DMA transfers. I have a proof of concept in a branch but the API is hacky: It's great for PIO programs that are just converting from one digital format to another. Super fast data transfers and the CPU barely has to get involved. |
@bschwind if work go as planned pio-to-pio dma will just work too but i think pio fifo reg would need to be exposed as well |
@djdisodo that's great to hear! And yes, I think the FIFO registers would need to be exposed, though you could maybe set up an API where you don't have to expose them to users. Something like sm.rx().dma_to_pio(dma.reborrow(), other_sm.tx(), false).wait().await; I haven't put too much thought into a nice API yet though. |
i was trying to use pio with this i think there are several ways we can expose these
although it's used mostly for dma this eliminates chance of it being used for other things(if there's any)
but vcell crate itself allows mutating with immutable reference which is weird
but current design doesn't expose pac main issue is these are clonable i think i have to go with 1 probably also splitting TargetRef and TargetMut into Target/TargetRef/TargetMut to prevent reading from txf or such where reading behavior isn't defined |
Signed-off-by: sodo <[email protected]>
Signed-off-by: sodo <[email protected]>
Not sure I follow completely, txf/rxf aren't exposed for users of the That being said, I haven't devoted much of my time to this to know well the details on what will work and what won't, so I have limited input to give you at the moment, sorry. |
Signed-off-by: sodo <[email protected]>
Signed-off-by: sodo <[email protected]>
decisions
|
here's example code that uses this api fn a() -> u32 {
let (rx, tx) = self.sm1.rx_tx();
let buffer = UnsafeCell::from_mut(buffer);
let read_dma_target = unsafe { buffer.as_ref_unchecked() };
let write_dma_target = unsafe { buffer.as_mut_unchecked() };
let (mut rxt, tcount_original) = rx.dma_read_with_transfer_count(rxc, write_dma_target, u32::MAX);
let mut txt = tx.dma_write_with_transfer_count(txc, read_dma_target, u32::MAX).0;
select(
join(
rxt.wait(),
txt.wait(),
),
self.irq_cs.wait()
).await;
let tcount = rxt.transfer_count();
drop((rxt, txt));
self.sm1.set_enable(false);
tcount_original - tcount
} |
motivation: need better way to cancel dma mid flight and read remaining transfer count
dma transfer's are built using
TransferBuilder
this should support wide range of configuration, repeating read/write, ring read/ring write, etc
configuration errors are caught in compile time