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] - Blame information for rev 3

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

Line No. Rev Author Line
1 3 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Check target status: run or not.
6
 */
7
 
8
#include "cmd_isrunning.h"
9
 
10
namespace debugger {
11
 
12
CmdIsRunning::CmdIsRunning(ITap *tap, ISocInfo *info)
13
    : ICommand ("isrunning", tap, info) {
14
 
15
    briefDescr_.make_string("Check target's status");
16
    detailedDescr_.make_string(
17
        "Description:\n"
18
        "    Check target's status as a boolean value.\n"
19
        "Example:\n"
20
        "    isrunning\n");
21
}
22
 
23
bool CmdIsRunning::isValid(AttributeType *args) {
24
    if ((*args)[0u].is_equal(cmdName_.to_string()) && args->size() == 1) {
25
        return CMD_VALID;
26
    }
27
    return CMD_INVALID;
28
}
29
 
30
void CmdIsRunning::exec(AttributeType *args, AttributeType *res) {
31
    res->make_boolean(false);
32
    if (!isValid(args)) {
33
        generateError(res, "Wrong argument list");
34
        return;
35
    }
36
 
37
    Reg64Type t1;
38
    DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
39
    DsuMapType *pdsu = info_->getpDsu();
40
    uint64_t addr = reinterpret_cast<uint64_t>(&pdsu->udbg.v.control);
41
    tap_->read(addr, 8, t1.buf);
42
    ctrl.val = t1.val;
43
    if (ctrl.bits.halt) {
44
        res->make_boolean(false);
45
    } else {
46
        res->make_boolean(true);
47
    }
48
}
49
 
50
}  // namespace debugger

powered by: WebSVN 2.1.0

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