From 14b7a9cdee8247a02c17c484cd8b30fe1a7292c0 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 27 Jan 2013 18:48:30 -0300 Subject: [PATCH] ubb-la/ubb-la.c (xfers): instead of waiting for event, use hand-optimized delay loop The gap is just as long as when waiting for an event but the "start bit" on DAT0 has vanished completely: 1 3 gap 2 0 1 3 ------- ------- ------- ------- ------- ------- ------- 53 77 16 146 66 79 1 146 81 79 132 96 79 117 --- ubb-la/ubb-la.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ubb-la/ubb-la.c b/ubb-la/ubb-la.c index dfa0a01..f94cb93 100644 --- a/ubb-la/ubb-la.c +++ b/ubb-la/ubb-la.c @@ -190,10 +190,19 @@ static void xfers(unsigned long *bufs, int n_bufs, int nibbles) dma_setup(bufs[0], nibbles); while (1) { + int j; + MSC_STRPCL = MSC_STRPCRL_START_OP; + /* + * Experimental value for 12 MSa/s: hangs always/usually with + * 231 cycles, hangs sometimes with 232, hands never (so far) + * with 233. + */ + for (j = 0; j != 233; j++) asm volatile (""); + // while (MSC_STAT & MSC_STAT_DATA_FIFO_EMPTY); - while (!(MSC_STAT & MSC_STAT_END_CMD_RES)); +// while (!(MSC_STAT & MSC_STAT_END_CMD_RES)); IN(UBB_CMD);