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:
Jared Boone
2013-12-08 13:14:26 -08:00
parent ea2ca52301
commit ca070acad0
2 changed files with 17 additions and 18 deletions

View File

@ -29,7 +29,7 @@
#include <sgpio.h>
#include <gpdma.h>
static void sgpio_dma_configure_lli(
void sgpio_dma_configure_lli(
gpdma_lli_t* const lli,
const size_t lli_count,
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);
}
#define RX_LLI_COUNT 4
#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);
void sgpio_dma_init() {
/* DMA peripheral/source 0, option 2 (SGPIO14) -- BREQ */
CREG_DMAMUX &= ~(CREG_DMAMUX_DMAMUXPER0_MASK);
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;
void sgpio_dma_rx_start() {
sgpio_dma_enable(dma_channel_sgpio, lli_rx, false);
void sgpio_dma_rx_start(const gpdma_lli_t* const start_lli) {
sgpio_dma_enable(dma_channel_sgpio, start_lli, false);
}
void sgpio_dma_tx_start() {
sgpio_dma_enable(dma_channel_sgpio, lli_tx, true);
void sgpio_dma_tx_start(const gpdma_lli_t* const start_lli) {
sgpio_dma_enable(dma_channel_sgpio, start_lli, true);
}
void sgpio_dma_irq_tc_acknowledge() {

View File

@ -26,9 +26,17 @@
#include <libopencm3/lpc43xx/gpdma.h>
void sgpio_dma_init(void* const buffer, const size_t byte_count);
void sgpio_dma_rx_start();
void sgpio_dma_tx_start();
void sgpio_dma_configure_lli(
gpdma_lli_t* const lli,
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_stop();