-
Notifications
You must be signed in to change notification settings - Fork 769
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
Add gpdma ringbuffer support #3162
base: main
Are you sure you want to change the base?
Add gpdma ringbuffer support #3162
Conversation
Update to embassy main
Merge latest from main repo
…lf IRQ with ring buffers
@Dirbaio I'm going to try and test this soon ( ™️ ) but I'm curious if I even updated some of this correctly. The APIs within DMA seem to have changed since Tyler originally implemented this branch. There were things like this: /// This is a Readable ring buffer. It reads data from a peripheral into a buffer. The reads happen in circular mode.
/// There are interrupts on complete and half complete. You should read half the buffer on every read.
pub struct ReadableRingBuffer<'a, C: Channel, W: Word> {
channel: PeripheralRef<'a, C>,
ringbuf: ReadableDmaRingBuffer<'a, W>,
} Where self.channel.regs().ch(self.channel.num()) This was no longer valid, and looking over the repository changes over the last few months, I realized that other similar code was now using a pattern where they had an /// This is a Readable ring buffer. It reads data from a peripheral into a buffer. The reads happen in circular mode.
/// There are interrupts on complete and half complete. You should read half the buffer on every read.
pub struct ReadableRingBuffer<'a, W: Word> {
channel: PeripheralRef<'a, AnyChannel>,
ringbuf: ReadableDmaRingBuffer<'a, W>,
} And now most of the references to that variable look like: let info = self.channel.info();
info.dma.ch(info.num) I'm not sure if that's the "correct" way to go about it, though. Given that the only place I saw the channel info exposed was AnyChannel and that AnyChannel could represent... well, any channel, the generic seemed unnecessary. Happy to be corrected though. |
Ah, I just had a look at |
@calebstewart I'm testing the ringbuffer support for use with USART, maybe the method @Dirbaio do you think a trait would be in order here? since even if we're using only a single implementation for each chip (BDMA or GPDMA) the interface should be the same regardless. |
This is an ongoing attempt to get the changes from #2302 merged and working. I'm by no means an expert here, and this is currently just a first-pass at getting the merge conflicts fixed. This hasn't been tested at all yet by me.