Expose SGPIO DMA LLI configuration function.
Remove LLI declarations internal to SGPIO DMA module. Require a start LLI for SGPIO DMA start functions.
This commit is contained in:
@ -29,7 +29,7 @@
|
|||||||
#include <sgpio.h>
|
#include <sgpio.h>
|
||||||
#include <gpdma.h>
|
#include <gpdma.h>
|
||||||
|
|
||||||
static void sgpio_dma_configure_lli(
|
void sgpio_dma_configure_lli(
|
||||||
gpdma_lli_t* const lli,
|
gpdma_lli_t* const lli,
|
||||||
const size_t lli_count,
|
const size_t lli_count,
|
||||||
const bool direction_transmit,
|
const bool direction_transmit,
|
||||||
@ -97,16 +97,7 @@ static void sgpio_dma_enable(const uint_fast8_t channel, const gpdma_lli_t* cons
|
|||||||
gpdma_channel_enable(channel);
|
gpdma_channel_enable(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RX_LLI_COUNT 4
|
void sgpio_dma_init() {
|
||||||
#define TX_LLI_COUNT 4
|
|
||||||
|
|
||||||
static gpdma_lli_t lli_rx[RX_LLI_COUNT];
|
|
||||||
static gpdma_lli_t lli_tx[TX_LLI_COUNT];
|
|
||||||
|
|
||||||
void sgpio_dma_init(void* const buffer, const size_t transfer_bytes) {
|
|
||||||
sgpio_dma_configure_lli(lli_rx, RX_LLI_COUNT, false, buffer, transfer_bytes);
|
|
||||||
sgpio_dma_configure_lli(lli_tx, TX_LLI_COUNT, true, buffer, transfer_bytes);
|
|
||||||
|
|
||||||
/* DMA peripheral/source 0, option 2 (SGPIO14) -- BREQ */
|
/* DMA peripheral/source 0, option 2 (SGPIO14) -- BREQ */
|
||||||
CREG_DMAMUX &= ~(CREG_DMAMUX_DMAMUXPER0_MASK);
|
CREG_DMAMUX &= ~(CREG_DMAMUX_DMAMUXPER0_MASK);
|
||||||
CREG_DMAMUX |= CREG_DMAMUX_DMAMUXPER0(0x2);
|
CREG_DMAMUX |= CREG_DMAMUX_DMAMUXPER0(0x2);
|
||||||
@ -120,12 +111,12 @@ void sgpio_dma_init(void* const buffer, const size_t transfer_bytes) {
|
|||||||
|
|
||||||
static const uint_fast8_t dma_channel_sgpio = 0;
|
static const uint_fast8_t dma_channel_sgpio = 0;
|
||||||
|
|
||||||
void sgpio_dma_rx_start() {
|
void sgpio_dma_rx_start(const gpdma_lli_t* const start_lli) {
|
||||||
sgpio_dma_enable(dma_channel_sgpio, lli_rx, false);
|
sgpio_dma_enable(dma_channel_sgpio, start_lli, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sgpio_dma_tx_start() {
|
void sgpio_dma_tx_start(const gpdma_lli_t* const start_lli) {
|
||||||
sgpio_dma_enable(dma_channel_sgpio, lli_tx, true);
|
sgpio_dma_enable(dma_channel_sgpio, start_lli, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sgpio_dma_irq_tc_acknowledge() {
|
void sgpio_dma_irq_tc_acknowledge() {
|
||||||
|
@ -26,9 +26,17 @@
|
|||||||
|
|
||||||
#include <libopencm3/lpc43xx/gpdma.h>
|
#include <libopencm3/lpc43xx/gpdma.h>
|
||||||
|
|
||||||
void sgpio_dma_init(void* const buffer, const size_t byte_count);
|
void sgpio_dma_configure_lli(
|
||||||
void sgpio_dma_rx_start();
|
gpdma_lli_t* const lli,
|
||||||
void sgpio_dma_tx_start();
|
const size_t lli_count,
|
||||||
|
const bool direction_transmit,
|
||||||
|
void* const buffer,
|
||||||
|
const size_t transfer_bytes
|
||||||
|
);
|
||||||
|
|
||||||
|
void sgpio_dma_init();
|
||||||
|
void sgpio_dma_rx_start(const gpdma_lli_t* const start_lli);
|
||||||
|
void sgpio_dma_tx_start(const gpdma_lli_t* const start_lli);
|
||||||
void sgpio_dma_irq_tc_acknowledge();
|
void sgpio_dma_irq_tc_acknowledge();
|
||||||
void sgpio_dma_stop();
|
void sgpio_dma_stop();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user