Esempio n. 1
0
void
test_longs(char *title, unsigned long _orig_pat, 
           unsigned long *start_addr, unsigned long *end_addr,
           munge_fun *fun, int _delay, int loops)
{
    unsigned long *p;
    unsigned long val, pat;
    int errs, idle, delay;

    tty_puts(title);
#ifdef DO_SPIN
    tty_puts("\n");
#endif

    // Fill SDRAM with various patterns
    p = start_addr;
    pat = _orig_pat;
    while (p != end_addr) {
        *p++ = pat;
        pat = (*fun)(pat);
    }

    while (loops-- > 0) {
        tty_puts("<");
        delay = _delay;
        while (delay-- > 0) {
            idle = 0xF000000;
            while (--idle > 0) ;
        }
        tty_puts(">");

        // Test SDRAM
        p = start_addr;
        pat = _orig_pat;
        errs = 0;
        while (p != end_addr) {
            if ((val = *p++) != pat) {
                if (++errs < MAX_ERRS) {
                    tty_puts("\nFailed at ");
                    tty_puthex(p-1);
                    tty_puts(", read: ");
                    tty_puthex(val);
                    tty_puts(", expected: ");
                    tty_puthex(pat);
                }
            }
            pat = (*fun)(pat);
        }

        tty_puts(" - done");
        if (errs) {
            tty_puts(" with ");
            tty_puthex(errs);
            tty_puts(" errors");
        }
        tty_puts("\n");
    }
}
Esempio n. 2
0
void
random_longs(unsigned long *start, unsigned long end)
{
    unsigned long *dp, *random, *random_end;
    unsigned long v1, v2;
    int errs, tries, total;

    random_end = (unsigned long *)((unsigned long)pseudo_random_data + sizeof(pseudo_random_data));

    dp = start;  random = pseudo_random_data;
    tty_putc('\r');
    tries = 0;
    while (dp != end) {
        *dp++ = *random++;
        if (random == random_end) {
            random = pseudo_random_data;
            if (++tries == 0x100) {
                tty_putc('.');            
                tries = 0;
                idle();
            }
        }
    }
    tty_putc('\r');

    dp = start;  random = pseudo_random_data;
    errs = 0;
    while (dp != end) {
        if ((v1 = *dp++) != (v2 = *random++)) {
            if (++errs < MAX_ERRS) {
                tty_puts("\nFailed at ");
                tty_puthex(dp-1);
                tty_puts(", v1: ");
                tty_puthex(v1);
                tty_puts(", v2: ");
                tty_puthex(v2);
                total = 0;
                for (tries = 0;  tries < 1024;  tries++) {
                    dp -= 2;  random -= 2;
                    if ((v1 = *dp++) != (v2 = *random++)) total++;
                    if ((v1 = *dp++) != (v2 = *random++)) total++;
                }
                tty_puts(", times: ");
                tty_puthex(total);
            }
        }
        if (random == random_end) {
            random = pseudo_random_data;
        }
    }
    if (errs) {
        tty_puts("\nTotal errors: ");
        tty_puthex(errs);
        tty_puts("\n");
    }
}
Esempio n. 3
0
void
tty_init(void)
{

#if 0
    tty_puts("\nUart: ");
    tty_puthex(uart->control, 2);
    tty_puts(", ");
    tty_puthex(uart->mode, 2);
    tty_puts(", ");
    tty_puthex(uart->baud, 2);
    tty_puts(", ");
    tty_puthex(uart->TxRx, 2);
    tty_puts("\n");
    tty_puts("\nStat at ");  tty_puthex(&uart->status, 8);  tty_puts("\n");
#endif
    _tty_init(uarts[0]);
    _tty_init(uarts[1]);
}
Esempio n. 4
0
//
// Read a character from a TTY port
//
static char
_tty_getc(volatile struct uart *uart)
{
    do {
#if 0
        if ((uart->status & 0xF0) != 0) {
            tty_puts("\nErr = ");
            tty_puthex(uart->TxRx, 2);
        }
#endif
    } while ((uart->status & SSR_RxFull) == 0);
    return uart->TxRx;
}
Esempio n. 5
0
void
parallel_longs(unsigned long _orig_pat, 
               unsigned long *start_buf1, 
               unsigned long *start_buf2,
               unsigned long *end_addr,
               munge_fun *fun)
{
    unsigned long *p1, *p2;
    unsigned long pat, v1, v2;
    int errs, loops;

    tty_puts("Parallel buffers\n");
    // Fill buffers
    p1 = start_buf1;
    p2 = start_buf2;
    pat = _orig_pat;
    while (p2 != end_addr) {
        *p1++ = pat;
        *p2++ = ~pat;
        pat = (*fun)(pat);
    }

    for (loops = 0;  loops < 4;  loops++) {
        // Compare buffers
        p1 = start_buf1;
        p2 = start_buf2;
        pat = _orig_pat;
        errs = 0;
        while (p2 != end_addr) {
            if (((v1 = *p1) != pat) ||
                ((v2 = *p2) != ~pat)) {
                if (++errs < MAX_ERRS) {
                    tty_puts("\nFailed at ");
                    tty_puthex(p1);
                    tty_puts(", v1: ");
                    tty_puthex(v1);
                    tty_puts(", v2: ");
                    tty_puthex(v2);
                }
            }
            p1++;  p2++;
            pat = (*fun)(pat);
        }
        p1 = start_buf1;
        p2 = start_buf2;
        pat = _orig_pat;
        errs = 0;
        while (p2 != end_addr) {
            if (((v1 = *p1) != pat) ||
                ((v2 = *p1) != pat)) {
                if (++errs < MAX_ERRS) {
                    tty_puts("\nFailed at ");
                    tty_puthex(p1);
                    tty_puts(", v1: ");
                    tty_puthex(v1);
                    tty_puts(", v2: ");
                    tty_puthex(v2);
                }
            }
            p1++;  p2++;
            pat = (*fun)(pat);
        }
        tty_puts(" - done");
        if (errs) {
            tty_puts(" with ");
            tty_puthex(errs);
            tty_puts(" errors");
        }
        tty_puts("\n");
    }
}