mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-24 00:08:25 +02:00
ubb-patgen/ubb-patgen.c: DMA has mystery glitches. Use PIO for now.
This commit is contained in:
parent
3febc9072a
commit
908b0631d1
@ -132,6 +132,8 @@ static int select_freq(struct mmcclk *res, int hz, int rel)
|
||||
/* ----- DMA the pattern --------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef USE_DMA
|
||||
|
||||
static uint32_t old_dmac;
|
||||
|
||||
|
||||
@ -179,6 +181,15 @@ 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)
|
||||
{
|
||||
@ -224,7 +235,9 @@ 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 */
|
||||
@ -252,6 +265,8 @@ 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
|
||||
@ -264,6 +279,17 @@ static void mmc_buffer(const struct mmcclk *clk,
|
||||
|
||||
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);
|
||||
|
||||
@ -280,10 +306,14 @@ 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;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user