1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-09-29 01:20:48 +03:00

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
This commit is contained in:
Werner Almesberger 2013-01-27 18:48:30 -03:00
parent 18a822b845
commit 14b7a9cdee

View File

@ -190,10 +190,19 @@ static void xfers(unsigned long *bufs, int n_bufs, int nibbles)
dma_setup(bufs[0], nibbles); dma_setup(bufs[0], nibbles);
while (1) { while (1) {
int j;
MSC_STRPCL = MSC_STRPCRL_START_OP; 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_DATA_FIFO_EMPTY);
while (!(MSC_STAT & MSC_STAT_END_CMD_RES)); // while (!(MSC_STAT & MSC_STAT_END_CMD_RES));
IN(UBB_CMD); IN(UBB_CMD);