forked from M-Labs/artiq
runtime: demonstrate basic inter-CPU communication
This commit is contained in:
parent
5fd7f68f48
commit
4b66e3108a
|
@ -305,6 +305,28 @@ static char *get_token(char **str)
|
|||
return d;
|
||||
}
|
||||
|
||||
static const unsigned int test_program[] = {
|
||||
0x1860dead, // l.movhi r3,0xdead
|
||||
0x1880d000, // l.movhi r4,0xd000
|
||||
0xa863beef, // l.ori r3,r3,0xbeef
|
||||
0xd4041800, // l.sw 0(r4),r3
|
||||
0x00000000, // l.j +0
|
||||
0x15000000, // l.nop
|
||||
};
|
||||
|
||||
static void cputest(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
kernel_cpu_reset_write(1);
|
||||
MMPTR(0xd0000000) = 0;
|
||||
memcpy((void *)0x41000000, test_program, sizeof(test_program));
|
||||
flush_l2_cache();
|
||||
kernel_cpu_reset_write(0);
|
||||
for(i=0;i<10;i++)
|
||||
printf("%08x\n", MMPTR(0xd0000000));
|
||||
}
|
||||
|
||||
static void do_command(char *c)
|
||||
{
|
||||
char *token;
|
||||
|
@ -327,6 +349,8 @@ static void do_command(char *c)
|
|||
else if(strcmp(token, "ddsftw") == 0) ddsftw(get_token(&c), get_token(&c));
|
||||
else if(strcmp(token, "ddstest") == 0) ddstest(get_token(&c));
|
||||
|
||||
else if(strcmp(token, "cputest") == 0) cputest();
|
||||
|
||||
else if(strcmp(token, "") != 0)
|
||||
printf("Command not found\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue