OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [or1ksim/] [testbench/] [mc_ssram.c] - Diff between revs 468 and 544

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 468 Rev 544
Line 21... Line 21...
#include "support.h"
#include "support.h"
 
 
#include "mc_common.h"
#include "mc_common.h"
#include "mc_ssram.h"
#include "mc_ssram.h"
#include "../peripheral/mc.h"
#include "../peripheral/mc.h"
 
#include "../peripheral/gpio.h"
#include "../peripheral/fields.h"
#include "../peripheral/fields.h"
 
 
typedef volatile unsigned long *REGISTER;
typedef volatile unsigned long *REGISTER;
 
 
REGISTER mc_poc        = (unsigned long*)(MC_BASE + MC_POC);
REGISTER mc_poc        = (unsigned long*)(MC_BASE + MC_POC);
REGISTER mc_csr        = (unsigned long*)(MC_BASE + MC_CSR);
REGISTER mc_csr        = (unsigned long*)(MC_BASE + MC_CSR);
REGISTER mc_ba_mask    = (unsigned long*)(MC_BASE + MC_BA_MASK);
REGISTER mc_ba_mask    = (unsigned long*)(MC_BASE + MC_BA_MASK);
 
 
 
REGISTER rgpio_out     = (unsigned long*)(GPIO_BASE + RGPIO_OUT);
 
REGISTER rgpio_in      = (unsigned long*)(GPIO_BASE + RGPIO_IN);
 
 
unsigned long lpoc;
unsigned long lpoc;
 
 
unsigned long set_config()
unsigned long set_config()
{
{
    REGISTER mc_csc;
    REGISTER mc_csc;
Line 56... Line 60...
{
{
    unsigned long ret;
    unsigned long ret;
    unsigned char ch;
    unsigned char ch;
 
 
    unsigned long test;
    unsigned long test;
 
    unsigned long gpio_pat;
 
 
    unsigned long nAddress;
    unsigned long nAddress;
    unsigned long nMemSize;
    unsigned long nMemSize;
    unsigned long mc_sel;
    unsigned long mc_sel;
 
 
    REGISTER mc_tms;
    REGISTER mc_tms;
    REGISTER mc_cs;
    REGISTER mc_cs;
 
 
 
    *rgpio_out = 0xFFFFFFFF;
 
 
    /* set configuration */
    /* set configuration */
    /* MC configuration set by except_mc.S prior to execution of main()
    /* MC configuration set by except_mc.S prior to execution of main()
    if ( (ret = set_config()) != 0) {
    if ( (ret = set_config()) != 0) {
        exit(ret);
        exit(ret);
    }
    }
    */
    */
 
 
 
    *rgpio_out = 0;
    for (ch=0; ch<8; ch++) {
    for (ch=0; ch<8; ch++) {
        if (MC_SSRAM_CSMASK && (0x01 << ch) ) {
        if (MC_SSRAM_CSMASK && (0x01 << ch) ) {
            printf ("--- Begin Test on CS%d ---\n", ch);
            printf ("--- Begin Test on CS%d ---\n", ch);
 
 
            mc_cs  = (unsigned long*)(MC_BASE + MC_CSC(ch));
            mc_cs  = (unsigned long*)(MC_BASE + MC_CSC(ch));
Line 115... Line 123...
                printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_cs, *mc_tms);
                printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_cs, *mc_tms);
 
 
                nAddress = mc_sel << 21;
                nAddress = mc_sel << 21;
                nAddress |= MC_MEM_BASE;
                nAddress |= MC_MEM_BASE;
                nMemSize = ( ((*mc_ba_mask && 0x000000FF) + 1) << 21);
                nMemSize = ( ((*mc_ba_mask && 0x000000FF) + 1) << 21);
 
 
 
                gpio_pat ^= 0x00000008;
 
                *rgpio_out = gpio_pat;
                ret = mc_test_row(nAddress, nAddress + nMemSize, MC_SSRAM_FLAGS);
                ret = mc_test_row(nAddress, nAddress + nMemSize, MC_SSRAM_FLAGS);
 
 
                printf("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret);
                printf("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret);
 
 
                if (ret) {
                if (ret) {
 
                    gpio_pat ^= 0x00000080;
 
                    *rgpio_out = gpio_pat;
 
                    report(ret);
                    return ret;
                    return ret;
                }
                }
 
 
            } /*for test*/
            } /*for test*/
        } /*if*/
        } /*if*/
    } /*for CS*/
    } /*for CS*/
    printf("--- End SSRAM tests ---\n");
    printf("--- End SSRAM tests ---\n");
 
    report(0xDEADDEAD);
 
 
 
    gpio_pat ^= 0x00000020;
 
    *rgpio_out = gpio_pat;
 
 
    return 0;
    return 0;
} /* main */
} /* main */
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.