1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 23:40:36 +02:00

ubb-patgen/ubb-patgen.c: DMA works now. Get rid of the PIO option.

This commit is contained in:
Werner Almesberger 2013-01-14 23:29:23 -03:00
parent b6ee672266
commit c6306ff591

View File

@ -26,7 +26,6 @@
#include <ubb/physmem.h>
#define USE_DMA
#define DMA 5
@ -137,8 +136,6 @@ static int select_freq(struct mmcclk *res, int hz, int rel)
/* ----- DMA the pattern --------------------------------------------------- */
#ifdef USE_DMA
static uint32_t old_dmac;
@ -186,15 +183,6 @@ static void wait_dma_done(void)
while (!((DCS(DMA) >> 3) & 1)); /* DCS.TT */
}
#else /* USE_DMA */
static void dma_init(void) {}
static void dma_cleanup(void) {}
static void dma_setup(unsigned long buf, int nibbles) {}
#endif /* !USE_DMA */
static void wait_response(void)
{
@ -240,9 +228,7 @@ static void mmc_buffer(const struct mmcclk *clk,
MSC_CMDAT =
(2 << 9) | /* 4 bit bus */
#ifdef USE_DMA
(1 << 8) | /* DMA */
#endif
(1 << 4) | /* write */
(1 << 3) | /* with data transfer */
1; /* R1 response */
@ -270,8 +256,6 @@ static void mmc_buffer(const struct mmcclk *clk,
PDFUNS = mask;
#ifdef USE_DMA
/*
* Send the pattern with DMA. Note that we still have to send the first
* pattern, since the static state we begin from may not have been
@ -283,18 +267,6 @@ static void mmc_buffer(const struct mmcclk *clk,
1; /* enable transfer */
wait_dma_done();
#else /* USE_DMA */
const uint32_t *p;
for (p = (void *) buf; p != (void *) buf+(nibbles >> 1); p++) {
while ((MSC_STAT >> 7) & 1);
MSC_TXFIFO = *p;
}
#endif /* !USE_DMA */
wait_fifo_empty();
wait_shifted(clk);
@ -311,7 +283,6 @@ static void mmc_buffer(const struct mmcclk *clk,
static void send_buffer(const struct mmcclk *clk,
const uint8_t *buf, int nibbles, uint32_t mask)
{
#ifdef USE_DMA
unsigned long phys;
if (cacheflush((void *) buf, nibbles >> 1, DCACHE)) {
@ -323,9 +294,6 @@ static void send_buffer(const struct mmcclk *clk,
phys = physmem_xlat((void *) buf);
mmc_buffer(clk, buf[0] >> 4, phys, nibbles, mask);
#else
mmc_buffer(clk, buf[0] >> 4, (unsigned long) buf, nibbles, mask);
#endif
}