mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 22:42:49 +02:00
ubb-patgen/: flush dcache and write buffer before doing DMA
This commit is contained in:
parent
908b0631d1
commit
b6ee672266
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
CC = mipsel-openwrt-linux-gcc
|
CC = mipsel-openwrt-linux-gcc
|
||||||
CFLAGS = -g -Wall -O9 -I../libubb/include
|
CFLAGS = -g -Wall -O9 -march=mips32 -I../libubb/include
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LDLIBS = -L../libubb -lubb -lm
|
LDLIBS = -L../libubb -lubb -lm
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <asm/cachectl.h>
|
||||||
|
|
||||||
#include <ubb/ubb.h>
|
#include <ubb/ubb.h>
|
||||||
#include <ubb/regs4740.h>
|
#include <ubb/regs4740.h>
|
||||||
@ -25,9 +26,13 @@
|
|||||||
#include <ubb/physmem.h>
|
#include <ubb/physmem.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define USE_DMA
|
||||||
#define DMA 5
|
#define DMA 5
|
||||||
|
|
||||||
|
|
||||||
|
extern int cacheflush(char *addr, int nbytes, int cache);
|
||||||
|
|
||||||
|
|
||||||
/* ----- List available bus clock frequencies ------------------------------ */
|
/* ----- List available bus clock frequencies ------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
@ -309,6 +314,13 @@ static void send_buffer(const struct mmcclk *clk,
|
|||||||
#ifdef USE_DMA
|
#ifdef USE_DMA
|
||||||
unsigned long phys;
|
unsigned long phys;
|
||||||
|
|
||||||
|
if (cacheflush((void *) buf, nibbles >> 1, DCACHE)) {
|
||||||
|
perror("cacheflush");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
asm("sync"); /* flush the write buffer */
|
||||||
|
|
||||||
phys = physmem_xlat((void *) buf);
|
phys = physmem_xlat((void *) buf);
|
||||||
mmc_buffer(clk, buf[0] >> 4, phys, nibbles, mask);
|
mmc_buffer(clk, buf[0] >> 4, phys, nibbles, mask);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user