Exemplo n.º 1
0
bool ProgAlgSram::ProgramSram(BinaryFile &file, Sram_Options_t options)
{
    struct timeval tv[2];
    bool verbose=io->getVerbose();
    gettimeofday(tv, NULL);

    // Switch to USER1 register, to access BSCAN..
    jtag->shiftIR(&USER1,0);

    if(options==FULL||options==WRITE_ONLY)
    {
        printf("\nProgramming SRAM\n");
        if(!Sram_Write(file.getData(), file.getLength(), verbose))
            return false;
    }

    if(options==FULL||options==VERIFY_ONLY)
    {
        printf("\nVerifying SRAM\n");
        if(!Sram_Verify(file.getData(), file.getLength(), verbose))
            return false;
    }

    if (verbose)
    {
        gettimeofday(tv+1, NULL);
        printf("\nTotal SRAM execution time %.1f ms\n", (double)deltaT(tv, tv + 1)/1.0e3);
    }

    /* JPROGAM: Trigerr reconfiguration, not explained in ug332, but
     DS099 Figure 28:  Boundary-Scan Configuration Flow Diagram (p.49) */
    if(options==FULL)
    {
        jtag->shiftIR(&JPROGRAM);
        Sleep(1000);//just wait a bit to make sure everything is done..
    }

    jtag->shiftIR(&BYPASS);

  return true;
}