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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_1_0/] [or1ksim/] [testbench/] [mc_ssram.c] - Diff between revs 997 and 1024

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

Rev 997 Rev 1024
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.