-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Currently, I am porting a Numerically Controlled Oscillator (NOC) from C++ to TinyGo for a Software Defined Radio (SDR) project on RPi Pico 2W targets. The NCO uses PIO with DMA to output square waves IO pins in the 10..100 MHz frequency range.
The package piolib
in rp2-pio/piolib/dma.go
provides an implementation of DMA functions. However, it does not export the main type dmaChannel type
although it does export some of its methods only.
Which makes the reuse of this partial DMA SDK harder than necessary, unless
a) I put my implementation of a specific NCO in the piolib/
, similar to spi
or ws2812b
, so that it can access the unexported DMA types and methods;
b) I wrap and export types and methods of piolib/dma.go
, or reimplement just what the NCO requires;
c) We change piolib/dma.go
so that it exports its types and methods, as @tdunning proposed recently in #16 (comment) as well.
About c), @soypat replied in #16 (comment):
That said I still am unsure of exporting the dmaChannel type since this package is not quite the ideal place to be pulling DMA logic from. Eventually when we do put the DMA logic in its final resting place (probably tinygo machine package) it will bring along these methods :)
What would be a sustainable way to proceed? Should we modify piolib/dma.go
and also update it for RP2350 1)? Or, has the time come to try and consolidate DMA in a new machine package that exports most of its components 2)?
- RP2350 has 16 DMA channels compared to 12 on RP2040.
- Static assignments of DMA channels to peripherals e.g. for
spi0DMAChannel
andspi1DMAChannel
only, are done in two (redundant?) placesrp2-pio/piolib/dma.go
as well as insrc/machine/machine_rp2.go
.