2012-02-03 06:08:17 -05:00
|
|
|
#include <irq.h>
|
|
|
|
#include <uart.h>
|
|
|
|
|
|
|
|
#include <system.h>
|
2014-02-21 11:55:05 -05:00
|
|
|
#include <generated/mem.h>
|
2013-11-24 13:50:17 -05:00
|
|
|
#include <generated/csr.h>
|
2012-02-03 06:08:17 -05:00
|
|
|
|
|
|
|
void flush_cpu_icache(void)
|
|
|
|
{
|
|
|
|
asm volatile(
|
|
|
|
"wcsr ICC, r0\n"
|
|
|
|
"nop\n"
|
|
|
|
"nop\n"
|
|
|
|
"nop\n"
|
|
|
|
"nop\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void flush_cpu_dcache(void)
|
|
|
|
{
|
|
|
|
asm volatile(
|
|
|
|
"wcsr DCC, r0\n"
|
|
|
|
"nop\n"
|
|
|
|
);
|
|
|
|
}
|
2013-11-16 10:27:21 -05:00
|
|
|
|
|
|
|
void flush_l2_cache(void)
|
|
|
|
{
|
|
|
|
unsigned int l2_nwords;
|
|
|
|
unsigned int i;
|
|
|
|
register unsigned int addr;
|
|
|
|
register unsigned int dummy;
|
|
|
|
|
|
|
|
l2_nwords = 1 << (identifier_l2_size_read() - 2);
|
|
|
|
for(i=0;i<2*l2_nwords;i++) {
|
|
|
|
addr = SDRAM_BASE + i*4;
|
|
|
|
__asm__ volatile("lw %0, (%1+0)\n":"=r"(dummy):"r"(addr));
|
|
|
|
}
|
|
|
|
}
|