summaryrefslogtreecommitdiff
path: root/libhw/rp2040_include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-24 22:54:30 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-04 00:10:03 -0700
commitc336bf7f2205131c86e6d2991770a2c150d85ca9 (patch)
tree963a91e278aaaa7ea7648a5e00043aca40ba8731 /libhw/rp2040_include
parentfb73355711c99003c559df48164a1ce6db93cff9 (diff)
libhw: rp2040_hwspi: Use DMA
Diffstat (limited to 'libhw/rp2040_include')
-rw-r--r--libhw/rp2040_include/libhw/rp2040_hwspi.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/libhw/rp2040_include/libhw/rp2040_hwspi.h b/libhw/rp2040_include/libhw/rp2040_hwspi.h
index fef1dbd..f90c1af 100644
--- a/libhw/rp2040_include/libhw/rp2040_hwspi.h
+++ b/libhw/rp2040_include/libhw/rp2040_hwspi.h
@@ -25,6 +25,10 @@ struct rp2040_hwspi {
uint64_t min_delay_ns;
uint8_t bogus_data;
uint pin_cs;
+ uint dma_tx_data;
+ uint dma_tx_ctrl;
+ uint dma_rx_data;
+ uint dma_rx_ctrl;
/* mutable */
uint64_t dead_until_ns;
@@ -47,6 +51,7 @@ LO_IMPLEMENTATION_H(spi, struct rp2040_hwspi, rp2040_hwspi)
* @param pin_mosi : uint : pin number; 3, 7, 19, or 23 for _HWSPI_0; 11, 15, or 27 for _HWSPI_1
* @param pin_clk : uint : pin number; 2, 6, 18, or 22 for _HWSPI_0; 10, 14, or 26 for _HWSPI_1
* @param pin_cs : uint : pin number; any unused GPIO pin
+ * @param dma{1-4} : uint : DMA channel; any unused channel
*
* There is no bit-order argument; the RP2040's hardware SPI always
* uses MSB-first bit order.
@@ -76,7 +81,8 @@ LO_IMPLEMENTATION_H(spi, struct rp2040_hwspi, rp2040_hwspi)
#define rp2040_hwspi_init(self, name, \
inst_num, mode, baudrate_hz, \
min_delay_ns, bogus_data, \
- pin_miso, pin_mosi, pin_clk, pin_cs) \
+ pin_miso, pin_mosi, pin_clk, pin_cs, \
+ dma1, dma2, dma3, dma4) \
do { \
bi_decl(bi_4pins_with_names(pin_miso, name" SPI MISO", \
pin_mosi, name" SPI MOSI", \
@@ -85,7 +91,8 @@ LO_IMPLEMENTATION_H(spi, struct rp2040_hwspi, rp2040_hwspi)
_rp2040_hwspi_init(self, \
inst_num, mode, baudrate_hz, \
min_delay_ns, bogus_data, \
- pin_miso, pin_mosi, pin_clk, pin_cs); \
+ pin_miso, pin_mosi, pin_clk, pin_cs, \
+ dma1, dma2, dma3, dma4); \
} while(0)
void _rp2040_hwspi_init(struct rp2040_hwspi *self,
enum rp2040_hwspi_instance inst_num,
@@ -96,6 +103,10 @@ void _rp2040_hwspi_init(struct rp2040_hwspi *self,
uint pin_miso,
uint pin_mosi,
uint pin_clk,
- uint pin_cs);
+ uint pin_cs,
+ uint dma1,
+ uint dma2,
+ uint dma3,
+ uint dma4);
#endif /* _LIBHW_RP2040_HWSPI_H_ */