4 * SPDX-License-Identifier: GPL-2.0+
8 static inline void ecc_off (void)
10 *(volatile int *) (INTERNAL_REG_BASE_ADDR + 0x4b4) &= ~0x00200000;
13 static inline void ecc_on (void)
15 *(volatile int *) (INTERNAL_REG_BASE_ADDR + 0x4b4) |= 0x00200000;
18 static int putshex (const char *buf, int len)
22 for (i = 0; i < len; i++) {
23 printf ("%02x", buf[i]);
28 static int char_memcpy (void *d, const void *s, int len)
34 for (i = 0; i < len; i++) {
40 static int memory_test (char *buf)
42 const char src[][16] = {
43 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
44 {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
45 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
46 {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
47 0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
48 {0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
49 0x04, 0x04, 0x04, 0x04, 0x04, 0x04},
50 {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
51 0x08, 0x08, 0x08, 0x08, 0x08, 0x08},
52 {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
53 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
54 {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
55 0x20, 0x20, 0x20, 0x20, 0x20, 0x20},
56 {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
57 0x40, 0x40, 0x40, 0x40, 0x40, 0x40},
58 {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
59 0x80, 0x80, 0x80, 0x80, 0x80, 0x80},
60 {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
61 0x55, 0x55, 0x55, 0x55, 0x55, 0x55},
62 {0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
63 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa},
64 {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
65 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
67 const int foo[] = { 0 };
70 printf ("\ntest @ %d %p\n", foo[0], buf);
71 for (i = 0; i < 12; i++) {
72 for (a = 0; a < 8; a++) {
73 const char *s = src[i] + a;
74 int align = (unsigned) (s) & 0x7;
80 if (memcmp (buf, s, 8)) {
83 printf (" [FAIL] (%p) align=%d\n", s, align);
84 for (j = 0; j < 8; j++) {
85 s[j] == buf[j] ? puts (" ") :
91 printf (" [PASS] (%p) align=%d\n", s, align);
94 char_memcpy (buf, s, 8);
97 if (memcmp (buf, s, 8)) {
100 printf (" [FAIL] (%p) align=%d\n", s, align);
101 for (j = 0; j < 8; j++) {
102 s[j] == buf[j] ? puts (" ") :
108 printf (" [PASS] (%p) align=%d\n", s, align);