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

Subversion Repositories or1k

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

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

Rev 997 Rev 1024
Line 49... Line 49...
        if (MC_SYNC_CSMASK & (0x01 << ch) ) {
        if (MC_SYNC_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_sync_cs[ch].M);
            SET_FIELD(*mc_csc, MC_CSC, SEL, mc_sync_cs[ch].M);
            SET_FIELD(*mc_csc, MC_CSC, BW,  2);
            SET_FIELD(*mc_csc, MC_CSC, BW,  2);
            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 71... Line 71...
    if ( (GET_FIELD(*mc_csc, MC_CSC, MEMTYPE) == 3) &&
    if ( (GET_FIELD(*mc_csc, MC_CSC, MEMTYPE) == 3) &&
         (TEST_FLAG(*mc_csc, MC_CSC, EN) == 1     ) ) {
         (TEST_FLAG(*mc_csc, MC_CSC, EN) == 1     ) ) {
      mc_sync_cs[ch].M  = GET_FIELD(*mc_csc, MC_CSC, SEL);
      mc_sync_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_sync_cs[ch].M);
             mc_sync_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(1);
      report(1);
      return(1);
      return(1);
    }
    }
#else
#else
    mc_cs = MC_ASYNC_CSMASK;
    mc_cs = MC_ASYNC_CSMASK;
#endif
#endif
 
 
    *rgpio_out = 0;
    *rgpio_out = 0;
    for (ch=0; ch<8; ch++) {
    for (ch=0; ch<8; ch++) {
        if (MC_SYNC_CSMASK & (0x01 << ch) ) {
        if (MC_SYNC_CSMASK & (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_SYNC_FLAGS);
                ret = mc_test_row(nAddress, nAddress + nMemSize, MC_SYNC_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 SYNC tests ---\n");
    printf("--- End SYNC 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.