aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-01-03 15:19:19 -0500
committerMarti Bolivar <mbolivar@leaflabs.com>2011-01-03 15:19:19 -0500
commite9af9d951a0341ea68ce88d7b5ee3b42b68494b6 (patch)
tree4ba9cf5dacfd724b82c734026e3cb510eb485684 /libmaple
parentfc727d99ac3f3d98eeba925fbbfee5cae2e7f8a4 (diff)
downloadlibrambutan-e9af9d951a0341ea68ce88d7b5ee3b42b68494b6.tar.gz
librambutan-e9af9d951a0341ea68ce88d7b5ee3b42b68494b6.zip
Documentation improvements, DMA IRQ table volatile bugfix.
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/dma.c2
-rw-r--r--libmaple/dma.h10
2 files changed, 11 insertions, 1 deletions
diff --git a/libmaple/dma.c b/libmaple/dma.c
index 70507b9..1de9b60 100644
--- a/libmaple/dma.c
+++ b/libmaple/dma.c
@@ -47,7 +47,7 @@ typedef struct DMAChannel {
uint32 irq_line;
} DMAChannel;
-static DMAChannel dma_channels[] = {
+volatile static DMAChannel dma_channels[] = {
{ .handler = NULL, .irq_line = NVIC_DMA_CH1 },
{ .handler = NULL, .irq_line = NVIC_DMA_CH2 },
{ .handler = NULL, .irq_line = NVIC_DMA_CH3 },
diff --git a/libmaple/dma.h b/libmaple/dma.h
index aabbfb8..3417f02 100644
--- a/libmaple/dma.h
+++ b/libmaple/dma.h
@@ -67,6 +67,7 @@ typedef enum dma_mode_flags {
DMA_TRNS_CMPLT = 1 << 1 /**< Interrupt on transfer completion */
} dma_mode_flags;
+/** Source and destination transfer sizes. */
typedef enum dma_transfer_size {
DMA_SIZE_8BITS = 0,
DMA_SIZE_16BITS = 1,
@@ -102,7 +103,16 @@ void dma_init(uint8 channel, volatile void *paddr,
* @see dma_init() */
void dma_start(uint8 channel, volatile void *buffer, uint16 count);
+/**
+ * Attach an interrupt handler for the given DMA channel.
+ * @param channel DMA channel (1..7)
+ * @param handler Interrupt handler to attach
+ * @see voidFuncPtr */
void dma_attach_interrupt(uint8 channel, voidFuncPtr handler);
+
+/**
+ * Detach any handler associated with the given DMA channel.
+ * @param channel Channel whose interrupt handler to detach. */
void dma_detach_interrupt(uint8 channel);
#ifdef __cplusplus