Files
vhdl/lib/CPUs/MIPS/bsp/examples/test_dcache.c
T
jens 191af92d47 Initial version
Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@790 cc03376c-175c-47c8-b038-4cd826a8556b
2010-03-13 14:13:53 +00:00

62 lines
902 B
C

#include <stdlib.h>
#include <stdio.h>
#include "libsys.h"
#include "libsys.h"
UINT32 tset(UINT32 *pMem)
{
__asm__
(
".set noreorder\n"
".set nomacro\n"
"addiu $t1, $0, 0x5555\n"
"lw $t0, 0(%[pMem])\n"
"sw $t1, 24(%[pMem])\n"
"addiu $t0, 8\n"
"sw $t0, 0(%[pMem])\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
"lw $v0, 24(%[pMem])\n"
".set macro\n"
".set reorder\n"
:
: [pMem] "r" (pMem)
: "t0", "t1"
);
}
int main(void)
{
int i;
volatile int *pLED = (int*)SYS_LED_PORT;
UINT64 *pBuf64;
UINT32 *pPtr;
pBuf64 = (UINT64*)0x4000FC80; //malloc(1024*sizeof(UINT32));
pPtr = (UINT32*)pBuf64;
for(i=0; i < 1024; i++)
*pPtr++ = i;
pPtr = (UINT32*)pBuf64;
sputs("Ptr: "); print_word((int)pPtr); sputs("\n");
DCACHE_invalidate_all();
*pLED = tset(pPtr);
return 0;
}