Skip to content
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

software/user: split DMA handling into an API #65

Merged
merged 7 commits into from
Dec 9, 2021

Conversation

sergachev
Copy link
Contributor

The purpose of this changeset is to provide a clean and simple API to handle DMA reads and writes in user software and examples of it. I know the pull request looks huge, but code is 95% same as before, just reshuffled into different functions/files and deduplicated. It's worth starting looking at it from litepcie_dma_minimal_example.c which should be self-explanatory:

  • create struct litepcie_dma_ctrl
  • init with litepcie_dma_init()
  • run litepcie_dma_process() in a loop
  • use litepcie_dma_next_read_buffer() and litepcie_dma_next_write_buffer() in the same loop to read/write buffers
  • end with litepcie_dma_cleanup()

Zero-copy can now be used seamlessly anywhere by passing a flag to litepcie_dma_init().

Note I was still not able to test litepcie_test record and play properly yet even after setting pcie_dma0.writer.sink.valid.eq(1), pcie_dma0.reader.source.ready.eq(1) even before these changes - not sure why.

litepcie_util dma_test seems to work correctly though.

@sjkelly
Copy link
Contributor

sjkelly commented Dec 1, 2021

I tested this locally on the fairwaves xtrx and both litepcie_util and litepcie_dma_minimal_example are failing to make DMA transfers in both normal and zero-copy mode.

@sergachev
Copy link
Contributor Author

Thanks for testing!
Does it work before these changes? Do you get any errors in console and dmesg?
I of course tested too (on acorn - https://github.com/sergachev/litepcie_acorn), but will be able to test again only in a week or so.

@sjkelly
Copy link
Contributor

sjkelly commented Dec 1, 2021

Does it work before these changes? Do you get any errors in console and dmesg?

Yes, the original userspace seems to work fine. I will keep investigating so I can give a better diagnostic.

@maleadt
Copy link
Contributor

maleadt commented Dec 7, 2021

I'm not seeing any issues here with an XTRX and this PR, both modes work.

@enjoy-digital
Copy link
Owner

Thanks @sergachev, this indeed simplifies thing and avoid some duplication. I've been able to also test it on SQRL Acorn successfully. I'll also add an example for litepcie_test record/play. So this looks good, I'm merging to avoid stalling other PRs on top of this.

@enjoy-digital enjoy-digital merged commit 7f1e393 into enjoy-digital:master Dec 9, 2021
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.

4 participants