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

Implement auto-discovery of required hardware resources #110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tzstoyanov
Copy link

@tzstoyanov tzstoyanov commented Jan 24, 2024

PIO-USB uses DMA channel, PIO instructions and State Machines to run its logic. These hardware resources are limited and usually can be shared between different modules. The current approach is the user to configure these resources manually and to resolve any possible conflicts. This approach may not work in all cases, especially in more complex systems. This patch implements logic for auto-discovery and allocation of required hardware resources. The Pico SDK has dedicated APIs for that. The existing approach for manual configuration still works, the auto-discovery logic is on top of it. How it can be triggered:

  • Instead of specifying a resource in pio_usb_configuration_t, set -1.
  • Auto-discovery is supported for all resources: pio_tx_num, pio_rx_num, tx_ch, sm_tx, sm_rx and sm_eop.
  • Mixed mode is also supported - some of the resources can be set manually, others can be auto-discovered.

Signed-off-by: Tzvetomir Stoyanov [email protected]

PIO-USB uses DMA channel, PIO instructions and State Machines to run its
logic. These hardware resources are limited and usually can be shared
between different modules. The current approach is the user to configure
these resources manually and to resolve any possible conflicts. This
approach may not work in all cases, especially in more complex systems.
This patch implements logic for auto-discovery and allocation of
required hardware resources. The Pico SDK has dedicated APIs for that.
The existing approach for manually configuration still works, the
auto-discovery logic is on top of it. How it can be triggered:
 - Instead of specifying a resource in pio_usb_configuration_t, set
   "-1".
 - Auto-discovery is supported of all resources: pio_tx_num, pio_rx_num,
   tx_ch, sm_tx, sm_rx and sm_eop.
 - Mixed mode is also supported - some of the resources can be set
   manually, others can be auto-discovered.

Signed-off-by: Tzvetomir Stoyanov <[email protected]>
Use the logic for hardware resources auto-discovery by default, set this
to be the PIO_USB_DEFAULT_CONFIG.

Signed-off-by: Tzvetomir Stoyanov <[email protected]>
@tzstoyanov
Copy link
Author

tzstoyanov commented Jan 26, 2024

fixes #24

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.

1 participant