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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [common/] [coreservices/] [icommand.h] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      User's command interface.
6
 */
7
 
8
#ifndef __DEBUGGER_ICOMMAND_H__
9
#define __DEBUGGER_ICOMMAND_H__
10
 
11
#include "iface.h"
12
#include "attribute.h"
13
#include "coreservices/itap.h"
14
#include "coreservices/isocinfo.h"
15
 
16
 
17
namespace debugger {
18
 
19
static const char *IFACE_COMMAND = "ICommand";
20
 
21
static const bool CMD_VALID     = true;
22
static const bool CMD_INVALID   = false;
23
 
24
class ICommand : public IFace {
25
public:
26
    ICommand(const char *name, ITap *tap, ISocInfo *info)
27
        : IFace(IFACE_COMMAND) {
28
        cmdName_.make_string(name);
29
        tap_ = tap;
30
        info_ = info;
31
    }
32
    virtual ~ICommand() {}
33
 
34
    virtual const char *cmdName() { return cmdName_.to_string(); }
35
    virtual const char *briefDescr() { return briefDescr_.to_string(); }
36
    virtual const char *detailedDescr() { return detailedDescr_.to_string(); }
37
 
38
    virtual bool isValid(AttributeType *args) =0;
39
    virtual void exec(AttributeType *args, AttributeType *res) =0;
40
 
41
    virtual void generateError(AttributeType *res, const char *descr) {
42
        res->make_list(3);
43
        (*res)[0u].make_string("ERROR");
44
        (*res)[1].make_string(cmdName_.to_string());
45
        (*res)[2].make_string(descr);
46
    }
47
 
48
protected:
49
    AttributeType cmdName_;
50
    AttributeType briefDescr_;
51
    AttributeType detailedDescr_;
52
    ITap *tap_;
53
    ISocInfo *info_;
54
};
55
 
56
}  // namespace debugger
57
 
58
#endif  // __DEBUGGER_ICOMMAND_H__

powered by: WebSVN 2.1.0

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