Skip to content

Implement functions to allow for DMA usage in audio driver.#804

Merged
hathach merged 15 commits into
masterfrom
audio_make_dma_ready
May 2, 2021
Merged

Implement functions to allow for DMA usage in audio driver.#804
hathach merged 15 commits into
masterfrom
audio_make_dma_ready

Conversation

@PanRe
Copy link
Copy Markdown
Collaborator

@PanRe PanRe commented Apr 23, 2021

Describe the PR
Follow the discussion in #593, this attempts to implement functions to allow for DMA usage in audio functions.

  • Add tud_audio_n_get_ep_out_ff(), tud_audio_n_get_ep_in_ff(),
    tud_audio_n_get_rx_support_ff(), and tud_audio_n_get_tx_support_ff()
  • Change get_linear_read/write_info() to return linear and wrapped part
    at once
  • Adjusted affected code in audio_device.c and tested with
    audio_4_channel.

Reinhard Panhuber added 3 commits April 23, 2021 10:27
- Add tud_audio_n_get_ep_out_ff(), tud_audio_n_get_ep_in_ff(),
tud_audio_n_get_rx_support_ff(), and tud_audio_n_get_tx_support_ff()
- Change get_linear_read/write_info() to return linear and wrapped part
at once
- Adjusted affected code in audio_device.c and tested with
audio_4_channel.
@HiFiPhile
Copy link
Copy Markdown
Collaborator

Change get_linear_read/write_info() to return linear and wrapped part at once

Oh thanks you are quick 😅, I think I would write it this weekend...

Comment thread src/common/tusb_fifo.c Outdated
Compilers always complain that variables set by function via pointer
might be uninitialized so to avoid that return values are now delivered
via struct.
@PanRe
Copy link
Copy Markdown
Collaborator Author

PanRe commented Apr 23, 2021

@hathach Could you have a look into this include hassle with pico.h? I don't know why this error comes up...

@HiFiPhile
Copy link
Copy Markdown
Collaborator

HiFiPhile commented Apr 23, 2021

Seems there is a dependency loop:
osal -> osal_pico -> tusb_fifo -> osal

@PanRe
Copy link
Copy Markdown
Collaborator Author

PanRe commented Apr 23, 2021

Ah yes again. This already was once an issue, but @hathach took care of it. I don't know how exactly. I guess this came up again somehow as i needed to include tusb_fifo.h within audio_device.h.

Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @PanRe for another great PR. Sorry the in cross include between pico and fifo is getting out of control. I temporarily fixed it by alternating the include order a bit and push the update. Will definitely fix it more properly later on with an overall include revise.

Except from that, I have an a couple of feedback, that I think we could simplify the API for the read/write buffer info. Let me know if that makes sense to you.

Comment thread src/common/tusb_fifo.h Outdated
Comment thread src/common/tusb_fifo.h Outdated
@PanRe
Copy link
Copy Markdown
Collaborator Author

PanRe commented Apr 30, 2021

OK all set up as desired!

Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superb ! Thank you for your effort, great PR as usual. the removal of offset make the whole fifo API much cleaner any easier to read/understand. FIFO should be supported offset (random) in the first place. It is my bad to introduce such operation with peek (since I thought it could be handy). Should user need to peek randomly, the new get_read_info() can be used to do it. I have a couple of minor clean up, along with a couple of unit test for new read/write info will push and merge it asap.

Comment thread src/common/tusb_fifo.c Outdated
Comment thread src/common/tusb_fifo.c Outdated
@hathach hathach merged commit 42a1d2f into master May 2, 2021
@hathach hathach deleted the audio_make_dma_ready branch May 2, 2021 08:29
@PanRe
Copy link
Copy Markdown
Collaborator Author

PanRe commented May 3, 2021

Thanks a lot! :)

@hathach
Copy link
Copy Markdown
Owner

hathach commented May 4, 2021

Thanks a lot! :)

I am the one to say thanks 👍

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