Example #1
0
void SpikeHw::writeFlash(unsigned long offset, const uint8_t *buf)
{
    maybeReset();

    if (verbose) fprintf(stderr, "SpikeHw::writeFlash offset=%lx value=%x\n", offset, *(uint32_t *)buf);
    request->writeFlash(offset, *(uint32_t *)buf);
    indication->wait();
}
Example #2
0
void SpikeHw::write(unsigned long offset, const uint32_t value)
{
    maybeReset();

    //if (verbose || (offset > 0x101000)) fprintf(stderr, "SpikeHw::write offset=%08lx value=%x\n", offset, value);
    request->write(offset, value);
    indication->wait();
    //if (verbose || (offset > 0x101000)) fprintf(stderr, "SpikeHw::write done\n");
}
Example #3
0
void FpgaDev::write(unsigned long offset, const uint32_t value)
{
    maybeReset();

    //std::lock_guard<std::mutex> lock(mutex);
    if (verbose) fprintf(stderr, "FpgaDev::write offset=%08lx value=%x\n", offset, value);
    request->write32(offset, value);
    indication->wait();
    if (verbose) fprintf(stderr, "FpgaDev::write done\n");
}
Example #4
0
void SpikeHw::readFlash(unsigned long offset, uint8_t *buf)
{
    maybeReset();

    if (verbose) fprintf(stderr, "SpikeHw::readFlash offset=%lx\n", offset);
    request->readFlash(offset);
    indication->wait();
    if (verbose) fprintf(stderr, "SpikeHw::readFlash offset=%lx value=%x\n", offset, *(uint32_t *)indication->buf);
    memcpy(buf, indication->buf, 4);
}
Example #5
0
uint32_t SpikeHw::read(unsigned long offset)
{
    maybeReset();

    //if (verbose || (offset > 0x101000)) fprintf(stderr, "SpikeHw::read offset=%08lx\n", offset);
    request->read(offset);
    indication->wait();
    //if (verbose || (offset > 0x101000)) fprintf(stderr, "SpikeHw::read done value=%x\n", *(uint32_t *)indication->buf);
    return *(uint32_t *)indication->buf;
}
Example #6
0
void FpgaDev::write(unsigned long offset, const uint8_t *buf)
{
    maybeReset();

    //std::lock_guard<std::mutex> lock(mutex);
    if (verbose) fprintf(stderr, "FpgaDev::write offset=%lx value=%x\n", offset, *(uint32_t *)buf);
    request->write32(offset, *(uint32_t *)buf);
    indication->wait();
    //request->status();
    //indication->wait();
}
Example #7
0
uint32_t FpgaDev::read(unsigned long offset)
{
    maybeReset();

    //std::lock_guard<std::mutex> lock(mutex);
    int count = readReq++;
    if (0 || verbose) fprintf(stderr, "FpgaDev::read offset=%08lx count=%d\n", offset, count);
    request->read32(offset);
    indication->wait();
    if (0 || verbose) fprintf(stderr, "FpgaDev::read done value=%x count=%d\n", *(uint32_t *)indication->buf, count);
    return *(uint32_t *)indication->buf;
}
Example #8
0
void FpgaDev::read(unsigned long offset, uint8_t *buf)
{
    maybeReset();

    //std::lock_guard<std::mutex> lock(mutex);
    int count = readReq++;
    if (0 || verbose) fprintf(stderr, "FpgaDev::read offset=%lx count=%d\n", offset, count);
    request->read32(offset);
    indication->wait();
    if (0 || verbose) fprintf(stderr, "FpgaDev::read offset=%lx value=%x count=%d\n", offset, *(uint32_t *)indication->buf, count);
    memcpy(buf, indication->buf, 4);
}