summaryrefslogtreecommitdiff
path: root/libhw_cr/rp2040_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhw_cr/rp2040_dma.c')
-rw-r--r--libhw_cr/rp2040_dma.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libhw_cr/rp2040_dma.c b/libhw_cr/rp2040_dma.c
index e117c19..8901f06 100644
--- a/libhw_cr/rp2040_dma.c
+++ b/libhw_cr/rp2040_dma.c
@@ -1,5 +1,8 @@
/* libhw_cr/rp2040_dma.c - Utilities for sharing the DMA IRQs
*
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
@@ -8,6 +11,21 @@
#include "rp2040_dma.h"
+/* Borrowed from <hardware/dma.h> *********************************************/
+
+dma_channel_hw_t *dma_channel_hw_addr(uint channel) {
+ assert(channel < NUM_DMA_CHANNELS);
+ return &dma_hw->ch[channel];
+}
+
+enum dma_channel_transfer_size {
+ DMA_SIZE_8 = 0, ///< Byte transfer (8 bits)
+ DMA_SIZE_16 = 1, ///< Half word transfer (16 bits)
+ DMA_SIZE_32 = 2 ///< Word transfer (32 bits)
+};
+
+/* Our own code ***************************************************************/
+
struct dmairq_handler_entry {
dmairq_handler_t fn;
void *arg;