4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 static inline void ecc_off (void)
26 *(volatile int *) (INTERNAL_REG_BASE_ADDR + 0x4b4) &= ~0x00200000;
29 static inline void ecc_on (void)
31 *(volatile int *) (INTERNAL_REG_BASE_ADDR + 0x4b4) |= 0x00200000;
34 static int putshex (const char *buf, int len)
38 for (i = 0; i < len; i++) {
39 printf ("%02x", buf[i]);
44 static int char_memcpy (void *d, const void *s, int len)
50 for (i = 0; i < len; i++) {
56 static int memory_test (char *buf)
58 const char src[][16] = {
59 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
60 {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
61 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
62 {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
63 0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
64 {0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
65 0x04, 0x04, 0x04, 0x04, 0x04, 0x04},
66 {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
67 0x08, 0x08, 0x08, 0x08, 0x08, 0x08},
68 {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
69 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
70 {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
71 0x20, 0x20, 0x20, 0x20, 0x20, 0x20},
72 {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
73 0x40, 0x40, 0x40, 0x40, 0x40, 0x40},
74 {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
75 0x80, 0x80, 0x80, 0x80, 0x80, 0x80},
76 {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
77 0x55, 0x55, 0x55, 0x55, 0x55, 0x55},
78 {0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
79 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa},
80 {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
81 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
83 const int foo[] = { 0 };
86 printf ("\ntest @ %d %p\n", foo[0], buf);
87 for (i = 0; i < 12; i++) {
88 for (a = 0; a < 8; a++) {
89 const char *s = src[i] + a;
90 int align = (unsigned) (s) & 0x7;
96 if (memcmp (buf, s, 8)) {
99 printf (" [FAIL] (%p) align=%d\n", s, align);
100 for (j = 0; j < 8; j++) {
101 s[j] == buf[j] ? puts (" ") :
107 printf (" [PASS] (%p) align=%d\n", s, align);
110 char_memcpy (buf, s, 8);
113 if (memcmp (buf, s, 8)) {
116 printf (" [FAIL] (%p) align=%d\n", s, align);
117 for (j = 0; j < 8; j++) {
118 s[j] == buf[j] ? puts (" ") :
124 printf (" [PASS] (%p) align=%d\n", s, align);