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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [libdbg64g/] [services/] [exec/] [cmd/] [cmd_isrunning.cpp] - Rev 2

Go to most recent revision | Compare with Previous | Blame | View Log

/**
 * @file
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
 * @brief      Check target status: run or not.
 */
 
#include "cmd_isrunning.h"
 
namespace debugger {
 
CmdIsRunning::CmdIsRunning(ITap *tap, ISocInfo *info) 
    : ICommand ("isrunning", tap, info) {
 
    briefDescr_.make_string("Check target's status");
    detailedDescr_.make_string(
        "Description:\n"
        "    Check target's status as a boolean value.\n"
        "Example:\n"
        "    isrunning\n");
}
 
bool CmdIsRunning::isValid(AttributeType *args) {
    if ((*args)[0u].is_equal(cmdName_.to_string()) && args->size() == 1) {
        return CMD_VALID;
    }
    return CMD_INVALID;
}
 
void CmdIsRunning::exec(AttributeType *args, AttributeType *res) {
    res->make_boolean(false);
    if (!isValid(args)) {
        generateError(res, "Wrong argument list");
        return;
    }
 
    Reg64Type t1;
    DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
    DsuMapType *pdsu = info_->getpDsu();
    uint64_t addr = reinterpret_cast<uint64_t>(&pdsu->udbg.v.control);
    tap_->read(addr, 8, t1.buf);
    ctrl.val = t1.val;
    if (ctrl.bits.halt) {
        res->make_boolean(false);
    } else {
        res->make_boolean(true);
    }
}
 
}  // namespace debugger
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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