summaryrefslogtreecommitdiff
path: root/chip/stm32/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/dma.c')
-rw-r--r--chip/stm32/dma.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/chip/stm32/dma.c b/chip/stm32/dma.c
index 935ffed038..ab8e8f2d58 100644
--- a/chip/stm32/dma.c
+++ b/chip/stm32/dma.c
@@ -78,8 +78,6 @@ static void prepare_channel(struct dma_channel *chan, unsigned count,
REG32(&chan->ccr) = ctrl;
ctrl |= flags;
- ctrl |= 0 << 10; /* MSIZE (memory size in bytes) */
- ctrl |= 1 << 8; /* PSIZE (16-bits for now) */
REG32(&chan->ccr) = ctrl;
}
@@ -89,19 +87,22 @@ void dma_go(struct dma_channel *chan)
REG32(&chan->ccr) |= DMA_EN;
}
-void dma_prepare_tx(struct dma_channel *chan, unsigned count, void *periph,
- const void *memory)
+void dma_prepare_tx(const struct dma_option *option, unsigned count,
+ const void *memory)
{
- prepare_channel(chan, count, periph, memory,
- DMA_MINC_MASK | DMA_DIR_FROM_MEM_MASK);
+ struct dma_channel *chan = dma_get_channel(option->channel);
+
+ prepare_channel(chan, count, option->periph, memory,
+ DMA_MINC_MASK | DMA_DIR_FROM_MEM_MASK | option->flags);
}
-int dma_start_rx(unsigned channel, unsigned count, void *periph,
+int dma_start_rx(const struct dma_option *option, unsigned count,
const void *memory)
{
- struct dma_channel *chan = dma_get_channel(channel);
+ struct dma_channel *chan = dma_get_channel(option->channel);
- prepare_channel(chan, count, periph, memory, DMA_MINC_MASK);
+ prepare_channel(chan, count, option->periph, memory,
+ DMA_MINC_MASK | option->flags);
dma_go(chan);
return 0;
}