vifill.c
1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "cpusim.h"
#define CMEM_WORD (*(vu32*)K0BASE)
#define UMEM_WORD (*(vu32*)K1BASE)
#define CMEM64_WORD (*(vu32*)PHYS_TO_K0(DDRRAM64_START))
#define UMEM64_WORD (*(vu32*)PHYS_TO_K1(DDRRAM64_START))
#define CNONMEM_WORD (*(vu32*)PHYS_TO_K0(PI_BUFFER_BASE_REG))
#define UNONMEM_WORD (*(vu32*)PHYS_TO_K1(PI_BUFFER_BASE_REG))
#define UI1_SEC 0x4a40010
#define UI1_FRAME_ADDR 0x4a801F0
#define UI1_LEN 0x4a801F4
#define UI1_DATA 0x4a801F8
main() {
int i;
unsigned int len, addr, data;
vu32 *p;
if (((getcp0reg(C0_CONFIG)&CONFIG_EC) >> 28) != 1)
IO_WRITE(MI_CTRL_REG, MI_CTRL_HARD_RESET|MI_CTRL_DIV_MODE_1_5);
test_preamble();
initICache();
initDCache();
init_ddr();
IO_WRITE(UI1_SEC, 1);
addr = IO_READ(UI1_FRAME_ADDR) & 0xfffffc;
len = IO_READ(UI1_LEN);
data = IO_READ(UI1_DATA);
p = (vu32 *) (K1BASE + addr);
for (i=0; i<len; i++) *p++ = data;
DBG_JTAG_PASS("memory fill test passed\n");
test_postamble();
return 0;
}