2 * Copyright (C) 1996 Paul Mackerras.
7 #define scanhex xmon_scanhex
8 #define skipbl xmon_skipbl
10 #define ADB_B (*(volatile unsigned char *)0xf3016000)
11 #define ADB_SR (*(volatile unsigned char *)0xf3017400)
12 #define ADB_ACR (*(volatile unsigned char *)0xf3017600)
13 #define ADB_IFR (*(volatile unsigned char *)0xf3017a00)
15 static inline void eieio(void) { asm volatile ("eieio" : :); }
17 #define N_ADB_LOG 1000
30 adb_log[0].ifr = ADB_IFR;
31 adb_log[0].acr = ADB_ACR;
32 adb_log[0].time = get_dec();
45 for (i = 0; i <= n_adb_log; ++i, ++ap) {
47 printf("b=%x ifr=%x acr=%x at %d.%.7d\n", ap->b, ap->ifr, ap->acr,
48 t / 1000000000, (t % 1000000000) / 100);
55 struct adb_log *ap = &adb_log[n_adb_log + 1];
60 if (ap->b != ap[-1].b || (ap->ifr & 4) != (ap[-1].ifr & 4)
61 || ap->acr != ap[-1].acr) {
68 adb_bitwait(int bmask, int bval, int fmask, int fval)
73 for (i = 10000; i > 0; --i) {
75 ap = &adb_log[n_adb_log];
76 if ((ap->b & bmask) == bval && (ap->ifr & fmask) == fval)
85 if (adb_bitwait(0, 0, 4, 4) < 0) {
86 printf("adb: ready wait timeout\n");
99 printf("ADB_B: %x\n", ADB_B);
121 for (j = 0; j < i; ++j)
122 printf("%.2x ", d[j]);
127 adb_write(unsigned char *d, int i)
132 if ((ADB_B & 8) == 0) {
152 for (j = 1; j < i; ++j) {
172 unsigned rtcu, rtcl, dec, pdec, x;
183 printf("rtc u=%u l=%u dec=%x (%d = %d.%.7d)\n",
184 rtcu, rtcl, dec, pdec - dec, (pdec - dec) / 1000000000,
185 ((pdec - dec) % 1000000000) / 100);
189 while (xmon_read(stdin, &cmd, 1) != 1)
195 while (adb_bitwait(8, 0, 0, 0) == 0)
204 printf("sent %d bytes\n", j);
205 while (adb_bitwait(8, 0, 0, 0) == 0)