- add ICache test
git-svn-id: http://moon:8086/svn/mips@131 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
+55
-1
@@ -18,9 +18,31 @@
|
||||
#define TEST16_ERROR (ERROR | 0x1600)
|
||||
|
||||
extern int paranoia(int argc, char **argv);
|
||||
|
||||
gpio_if_t gpio_if;
|
||||
|
||||
uint32_t test_icache_instr[] =
|
||||
{
|
||||
0x27bdfff8, // addiu sp,sp,-8
|
||||
0xafbe0004, // sw s8,4(sp)
|
||||
0xafb00000, // sw s0,0(sp)
|
||||
0x03a0f021, // move s8,sp
|
||||
0x24100001, // li s0,1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x00108040, // sll s0,s0,0x1
|
||||
0x02001021, // move v0,s0
|
||||
0x03c0e821, // move sp,s8
|
||||
0x8fbe0004, // lw s8,4(sp)
|
||||
0x8fb00000, // lw s0,0(sp)
|
||||
0x27bd0008, // addiu sp,sp,8
|
||||
0x03e00008, // jr ra
|
||||
0x00000000 // nop
|
||||
};
|
||||
|
||||
uint32_t* pf(void)
|
||||
{
|
||||
@@ -809,6 +831,30 @@ int Test16_MemTest(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t test_Icache()
|
||||
{
|
||||
typedef uint32_t (*func_t)(void);
|
||||
|
||||
uint32_t *pInstr = malloc(sizeof(test_icache_instr));
|
||||
memcpy(pInstr, test_icache_instr, sizeof(test_icache_instr));
|
||||
func_t pF = (func_t)pInstr;
|
||||
|
||||
uint32_t v = pF();
|
||||
printf("v = %u\n", (unsigned)v);
|
||||
|
||||
pInstr[4] = 0x24100002;
|
||||
v = pF();
|
||||
printf("v = %u\n", (unsigned)v);
|
||||
|
||||
ICACHE_invalidate_at(&pInstr[4]);
|
||||
v = pF();
|
||||
printf("v = %u\n", (unsigned)v);
|
||||
|
||||
free(pF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int result, i, j, cnt, size;
|
||||
@@ -992,6 +1038,14 @@ int main (void)
|
||||
// break;
|
||||
// printf("passed\n\n");
|
||||
|
||||
printf("-------------------------------------------\n");
|
||||
printf("-- I-Cache test ---------------------------\n");
|
||||
printf("-------------------------------------------\n");
|
||||
result = test_Icache();
|
||||
if (IS_ERROR(result))
|
||||
break;
|
||||
printf("passed\n\n");
|
||||
|
||||
printf("Iteration %d: Passed\n", cnt);
|
||||
curr_date = time(NULL);
|
||||
pDate = gmtime(&curr_date);
|
||||
|
||||
Reference in New Issue
Block a user