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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [gui_plugin/] [gui_plugin.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      GUI for the RISC-V debugger.
6
 */
7
#ifndef __DEBUGGER_GUI_PLUGIN_H__
8
#define __DEBUGGER_GUI_PLUGIN_H__
9
 
10
#include "iclass.h"
11
#include "iservice.h"
12
#include "ihap.h"
13
#include "igui.h"
14
#include "coreservices/ithread.h"
15
#include "coreservices/isocinfo.h"
16
#include "coreservices/icmdexec.h"
17
#include "MainWindow/DbgMainWindow.h"
18
 
19
namespace debugger {
20
 
21
class GuiPlugin : public IService,
22
                  public IThread,
23
                  public IHap,
24
                  public IGui {
25
public:
26
    GuiPlugin(const char *name);
27
    ~GuiPlugin();
28
 
29
    /** IService interface */
30
    virtual void initService(const AttributeType *args);
31
    virtual void postinitService();
32
 
33
    /** IHap */
34
    virtual void hapTriggered(IFace *isrc, EHapType type, const char *descr);
35
 
36
    /** IGui interface */
37
    virtual IFace *getSocInfo();
38
    virtual void getWidgetsAttribute(const char *name, AttributeType *out);
39
    virtual void registerCommand(IGuiCmdHandler *src, AttributeType *cmd,
40
                                 bool silent);
41
    virtual void removeFromQueue(IFace *iface);
42
 
43
    /** IThread interface */
44
    virtual void stop();
45
protected:
46
    virtual void busyLoop();
47
 
48
private:
49
    bool processCmdQueue();
50
 
51
private:
52
    /**
53
     * This UiThread and UiInitDone event allow us to register all widgets
54
     * interfaces before PostInit stage started and as results make them
55
     * visible to all other plugins.
56
     */
57
    class UiThreadType : public IThread {
58
    public:
59
        UiThreadType(IGui *igui, event_def *init_done) {
60
            igui_ = igui;
61
            eventInitDone_ = init_done;
62
            mainWindow_ = 0;
63
        }
64
        DbgMainWindow *mainWindow() { return mainWindow_; }
65
    protected:
66
        /** IThread interface */
67
        virtual void busyLoop();
68
    private:
69
        IGui *igui_;
70
        DbgMainWindow *mainWindow_;
71
        event_def *eventInitDone_;
72
    } *ui_;
73
 
74
    static const int CMD_QUEUE_SIZE = 128;
75
 
76
    AttributeType guiConfig_;
77
    AttributeType socInfo_;
78
    AttributeType cmdExecutor_;
79
 
80
    ISocInfo *info_;
81
    ICmdExecutor *iexec_;
82
 
83
    event_def eventUiInitDone_;
84
    event_def eventCommandAvailable_;
85
    event_def config_done_;
86
    mutex_def mutexCommand_;
87
    struct CmdQueueItemType {
88
        AttributeType cmd;
89
        IGuiCmdHandler *src;
90
        bool silent;
91
    } cmdQueue_[CMD_QUEUE_SIZE];
92
    int cmdQueueWrPos_;
93
    int cmdQueueRdPos_;
94
    int cmdQueueCntTotal_;
95
};
96
 
97
DECLARE_CLASS(GuiPlugin)
98
 
99
}  // namespace debugger
100
 
101
#endif  // __DEBUGGER_GUI_PLUGIN_H__

powered by: WebSVN 2.1.0

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