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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [testbench/] [mc_ssram.c] - Diff between revs 552 and 997

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

Rev 552 Rev 997
Line 48... Line 48...
    for (ch=0; ch<8; ch++) {
    for (ch=0; ch<8; ch++) {
        if (MC_SSRAM_CSMASK && (0x01 << ch) ) {
        if (MC_SSRAM_CSMASK && (0x01 << ch) ) {
            mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
            mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
            SET_FIELD(*mc_csc, MC_CSC, SEL, mc_ssram_cs[ch].M);
            SET_FIELD(*mc_csc, MC_CSC, SEL, mc_ssram_cs[ch].M);
            SET_FLAG(*mc_csc, MC_CSC, EN);
            SET_FLAG(*mc_csc, MC_CSC, EN);
            printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc);
            PRINTF ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc);
        }
        }
    }
    }
 
 
    return 0;
    return 0;
}
}
Line 70... Line 70...
    if ( (GET_FIELD(*mc_csc, MC_CSC, MEMTYPE) == 1) &&
    if ( (GET_FIELD(*mc_csc, MC_CSC, MEMTYPE) == 1) &&
         (TEST_FLAG(*mc_csc, MC_CSC, EN) == 1     ) ) {
         (TEST_FLAG(*mc_csc, MC_CSC, EN) == 1     ) ) {
      mc_ssram_cs[ch].M  = GET_FIELD(*mc_csc, MC_CSC, SEL);
      mc_ssram_cs[ch].M  = GET_FIELD(*mc_csc, MC_CSC, SEL);
      mc_cs |= (1 << ch);
      mc_cs |= (1 << ch);
 
 
      printf("get_config(%d) : M=0x%0lx\n", ch,
      PRINTF("get_config(%d) : M=0x%0lx\n", ch,
             mc_ssram_cs[ch].M);
             mc_ssram_cs[ch].M);
    }
    }
  }
  }
  printf("get_config() : cs=0x%0x\n", mc_cs);
  PRINTF("get_config() : cs=0x%0x\n", mc_cs);
  return 0;
  return 0;
}
}
 
 
int main()
int main()
{
{
Line 97... Line 97...
 
 
    *rgpio_out = 0xFFFFFFFF;
    *rgpio_out = 0xFFFFFFFF;
 
 
#ifdef MC_READ_CONF
#ifdef MC_READ_CONF
    if (get_config()) {
    if (get_config()) {
      printf("Error reading MC configuration\n");
      PRINTF("Error reading MC configuration\n");
      report(0x000000001);
      report(0x000000001);
      return(1);
      return(1);
    }
    }
#else
#else
    mc_cs = MC_SSRAM_CSMASK;
    mc_cs = MC_SSRAM_CSMASK;
#endif
#endif
 
 
    *rgpio_out = 0;
    *rgpio_out = 0;
    for (ch=0; ch<8; ch++) {
    for (ch=0; ch<8; ch++) {
        if (mc_cs & (0x01 << ch) ) {
        if (mc_cs & (0x01 << ch) ) {
            printf ("--- Begin Test on CS%d ---\n", ch);
            PRINTF ("--- Begin Test on CS%d ---\n", ch);
 
 
            mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
            mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
            mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch));
            mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch));
            mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL);
            mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL);
 
 
            printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n",
            PRINTF ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n",
                    *mc_csc, *mc_tms);
                    *mc_csc, *mc_tms);
 
 
            for (test=0; test<4; test++) {
            for (test=0; test<4; test++) {
                /* configure MC*/
                /* configure MC*/
                CLEAR_FLAG(*mc_csc, MC_CSC, PEN); /* no parity */
                CLEAR_FLAG(*mc_csc, MC_CSC, PEN); /* no parity */
Line 145... Line 145...
                        continue;
                        continue;
                    SET_FLAG(*mc_csc, MC_CSC, WP);  /* RO */
                    SET_FLAG(*mc_csc, MC_CSC, WP);  /* RO */
                    break;
                    break;
                } /*switch test*/
                } /*switch test*/
 
 
                printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms);
                PRINTF ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *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;
                gpio_pat ^= 0x00000008;
                *rgpio_out = gpio_pat;
                *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;
                    gpio_pat ^= 0x00000080;
                    *rgpio_out = gpio_pat;
                    *rgpio_out = gpio_pat;
                    report(ret);
                    report(ret);
Line 167... Line 167...
                }
                }
 
 
            } /*for test*/
            } /*for test*/
        } /*if*/
        } /*if*/
    } /*for CS*/
    } /*for CS*/
    printf("--- End SSRAM tests ---\n");
    PRINTF("--- End SSRAM tests ---\n");
    report(0xDEADDEAD);
    report(0xDEADDEAD);
 
 
    gpio_pat ^= 0x00000020;
    gpio_pat ^= 0x00000020;
    *rgpio_out = gpio_pat;
    *rgpio_out = gpio_pat;
 
 

powered by: WebSVN 2.1.0

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