##// END OF EJS Templates
New register explorer WIP...
jeandet -
r79:3440ba47d0f1 default
parent child
Show More
@@ -0,0 +1,44
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>RegsExplorerNew</class>
4 <widget class="QDockWidget" name="RegsExplorerNew">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Regs Explorer</string>
15 </property>
16 <widget class="QWidget" name="dockWidgetContents">
17 <layout class="QGridLayout" name="gridLayout">
18 <item row="0" column="1">
19 <widget class="QComboBox" name="comboBox"/>
20 </item>
21 <item row="0" column="0">
22 <widget class="QLabel" name="label">
23 <property name="text">
24 <string>Root Plugin</string>
25 </property>
26 </widget>
27 </item>
28 <item row="1" column="0" colspan="2">
29 <widget class="SocRegsViewerNew" name="regsViewer" native="true"/>
30 </item>
31 </layout>
32 </widget>
33 </widget>
34 <customwidgets>
35 <customwidget>
36 <class>SocRegsViewerNew</class>
37 <extends>QWidget</extends>
38 <header location="global">socregsviewernew.h</header>
39 <container>1</container>
40 </customwidget>
41 </customwidgets>
42 <resources/>
43 <connections/>
44 </ui>
@@ -1,4 +1,4
1 9790824220ca06014e65a5c13aa4ed37f89d7593 src/SocExplorerEngine/PeripheralWidget
1 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget
2 2 cc958c79ba0939809a70e63b8bac798930160243 src/common/genericBinaryFiles
3 3 2dce25b198558be573f56c1cf337aa95ddd666d6 src/common/lppserial
4 4 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit
@@ -3,4 +3,8
3 3 class test(PySocExplorerEngine.socexplorerplugin):
4 4 def hello(self):
5 5 print "hello"
6 def VID(self):
7 return 10
8 def PID(self):
9 return 100
6 10
@@ -11,6 +11,7 QGroupBox::title {
11 11 }
12 12
13 13 QWidget#CollapsablePeripheralWidget {
14 border: 1px solid gray;
15 border-radius: 9px;
14 border: 2px solid gray;
15 border-radius: 6px;
16 margin-top: 0.5em;
16 17 }
@@ -62,7 +62,8 void PythonConsole::changeSysDriverInstN
62 62 socexplorerplugin* obj= this->proxy->getSysDriver(previnstanceName);
63 63 if(obj==NULL)obj= this->proxy->getSysDriver(newinstanceName);
64 64 if(obj==NULL)return;
65 this->mainContext->addObject(newinstanceName,obj->getPyObjectWrapper());
65 // this->mainContext->addObject(newinstanceName,obj->getPyObjectWrapper());
66 this->mainContext->addObject(newinstanceName,obj);
66 67 this->mainContext->removeVariable(previnstanceName);
67 68 }
68 69
@@ -38,6 +38,9 public:
38 38 QString name(){return *_devName;}
39 39 bool visible(){return _visible;}
40 40 void setVisible(bool visible){_visible=visible;}
41 const QString& socName(){return _SOC->name();}
42 bool sameSoc(socExplorerEnumDevice* dev){return sameSoc(_SOC);}
43 bool sameSoc(SOCModel* soc){return soc==_SOC;}
41 44 signals:
42 45
43 46 public slots:
@@ -87,6 +87,7 public:
87 87 }
88 88 bool enumDeviceExists(qint32 baseAddress);
89 89 socExplorerEnumDevice *getEnumDevice(qint32 baseAddress);
90 const QString& name(){return p_name;}
90 91 public slots:
91 92 qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0);
92 93 qint32 getEnumDeviceCount(int VID,int PID);
@@ -96,6 +97,7 public slots:
96 97 qint32 readReg(qint32 address);
97 98 bool isLitleEndian();
98 99 private:
100 QString p_name;
99 101 socexplorerplugin* p_rootDev;
100 102 QList<socExplorerEnumDevice*> p_enumeratedDevices;
101 103 QList<SOCclk*> clktree;
@@ -103,7 +103,6 INCLUDEPATH += engine \
103 103 HEADERS += \
104 104 pluginloader/pluginscache.h \
105 105 pluginloader/pluginloader.h \
106 plugins/genericPySysdriver.h \
107 106 pluginManagerWdgt/plugintree.h \
108 107 pluginManagerWdgt/pluginmanagerWDGT.h \
109 108 pluginManagerWdgt/pluginlist.h \
@@ -150,7 +149,6 SOURCES += \
150 149 PeripheralWidget/src/registerwidget.cpp \
151 150 PeripheralWidget/src/socregsviewer.cpp \
152 151 SOC/socclk.cpp \
153 plugins/genericPySysdriver.cpp \
154 152 engine/socexplorerengine.cpp \
155 153 engine/socexplorerxmlfile.cpp \
156 154 proxy/socexplorerproxy.cpp \
@@ -48,7 +48,7 int socexplorerplugin::registermenu(QMen
48 48 {
49 49 this->childs.at(i)->registermenu(this->ChildsMenu);
50 50 }
51 if(this->pyObject!=NULL)emit this->registerObject((QObject*)this->pyObject,this->instanceName());
51 emit this->registerObject((QObject*)this,this->instanceName());
52 52 return 0;
53 53 }
54 54
@@ -75,6 +75,29 unsigned int socexplorerplugin::Read(uns
75 75 return 0;
76 76 }
77 77
78 QVariantList socexplorerplugin::Read(unsigned int address,unsigned int count)
79 {
80 unsigned int data[count];
81 QVariantList result;
82 Read(data,count,address);
83 for(unsigned int i = 0;i<count;i++)
84 {
85 result.append(QVariant((int)data[i]));
86 }
87 return result;
88 }
89 void socexplorerplugin::Write(unsigned int address,QList<QVariant> dataList)
90 {
91 unsigned int data[dataList.count()];
92 for(int i = 0;i<dataList.count();i++)
93 {
94 data[i] = (unsigned int)dataList.at(i).toUInt();
95 }
96 Write(data,dataList.count(),address);
97 }
98
99
100
78 101 void socexplorerplugin::closeMe(){emit this->closePlugin(this);}
79 102
80 103 void socexplorerplugin::activate(bool flag){this->setEnabled(flag);emit this->activateSig(flag);}
@@ -238,7 +261,4 bool socexplorerplugin::dumpMemory(unsig
238 261 return false;
239 262 }
240 263
241 void socexplorerplugin::makeGenericPyWrapper()
242 {
243 this->pyObject = new genericPySysdriver(this);
244 }
264
@@ -42,7 +42,6
42 42 #include <QFile>
43 43 #include <stdint.h>
44 44 #include <QTextStream>
45 #include <genericPySysdriver.h>
46 45 #include <abstractbinfile.h>
47 46 #ifndef driver_Name
48 47 #define driver_Name "Plugin"
@@ -102,10 +101,6 public:
102 101 _canBeRoot = driver_can_be_root;
103 102 _VID = driver_VID;
104 103 _PID = driver_PID;
105 if(createPyObject)
106 {
107 this->makeGenericPyWrapper();
108 }
109 104 }
110 105 //! Tells if the plugin is connected, it is used to enable or disable all childrens interfaces.
111 106 virtual int isConnected();
@@ -126,11 +121,11 public:
126 121 //! be set by SocExplorer and it can be user accessible if you want.
127 122 virtual void setBaseAddress(unsigned int baseAddress);
128 123
129 genericPySysdriver* getPyObjectWrapper(){return this->pyObject;}
130 124 QList<socexplorerplugin*> childs;
131 125 socexplorerplugin* parent;
132 126 QAction* closeAction;
133 127 QString instanceName();
128 QString instance(){return instanceName();}
134 129 QMenu* menu;
135 130 QMenu* ChildsMenu;
136 131
@@ -168,11 +163,11 public slots:
168 163 virtual bool loadbin(unsigned int address,QString file);
169 164 virtual bool loadfile(abstractBinFile* file);
170 165 virtual bool dumpMemory(unsigned int address,unsigned int count,QString file,const QString& format);
166 QVariantList Read(unsigned int address, unsigned int count);
167 void Write(unsigned int address, QList<QVariant> dataList);
171 168 protected:
172 void makeGenericPyWrapper();
173 169 int BaseAddress;
174 170 bool Connected;
175 genericPySysdriver* pyObject;
176 171 QString* _Name;
177 172 QString* _Author;
178 173 QString* _Version;
@@ -1542,6 +1542,11 bool PythonQtWrapper_socexplorerplugin:
1542 1542 return ( ((PythonQtPublicPromoter_socexplorerplugin*)theWrappedObject)->promoted_dumpMemory(address, count, file, format));
1543 1543 }
1544 1544
1545 QString PythonQtWrapper_socexplorerplugin::instance(socexplorerplugin* theWrappedObject)
1546 {
1547 return ( theWrappedObject->instance());
1548 }
1549
1545 1550 QString PythonQtWrapper_socexplorerplugin::instanceName(socexplorerplugin* theWrappedObject)
1546 1551 {
1547 1552 return ( theWrappedObject->instanceName());
@@ -1557,11 +1562,6 bool PythonQtWrapper_socexplorerplugin:
1557 1562 return ( ((PythonQtPublicPromoter_socexplorerplugin*)theWrappedObject)->promoted_loadbin(address, file));
1558 1563 }
1559 1564
1560 void PythonQtWrapper_socexplorerplugin::makeGenericPyWrapper(socexplorerplugin* theWrappedObject)
1561 {
1562 ( ((PythonQtPublicPromoter_socexplorerplugin*)theWrappedObject)->promoted_makeGenericPyWrapper());
1563 }
1564
1565 1565 bool PythonQtWrapper_socexplorerplugin::memSet(socexplorerplugin* theWrappedObject, unsigned int address, int value, unsigned int count)
1566 1566 {
1567 1567 return ( ((PythonQtPublicPromoter_socexplorerplugin*)theWrappedObject)->promoted_memSet(address, value, count));
@@ -125,7 +125,6 inline bool promoted_dumpMemory(unsigne
125 125 inline bool promoted_dumpMemory(unsigned int address, unsigned int count, QString file, const QString& format) { return socexplorerplugin::dumpMemory(address, count, file, format); }
126 126 inline int promoted_isConnected() { return socexplorerplugin::isConnected(); }
127 127 inline bool promoted_loadbin(unsigned int address, QString file) { return socexplorerplugin::loadbin(address, file); }
128 inline void promoted_makeGenericPyWrapper() { socexplorerplugin::makeGenericPyWrapper(); }
129 128 inline bool promoted_memSet(unsigned int address, int value, unsigned int count) { return socexplorerplugin::memSet(address, value, count); }
130 129 inline void promoted_postInstantiationTrigger() { socexplorerplugin::postInstantiationTrigger(); }
131 130 inline int promoted_registermenu(QMenu* menu) { return socexplorerplugin::registermenu(menu); }
@@ -149,10 +148,10 void delete_socexplorerplugin(socexplore
149 148 void closeMe(socexplorerplugin* theWrappedObject);
150 149 bool dumpMemory(socexplorerplugin* theWrappedObject, unsigned int address, unsigned int count, QString file);
151 150 bool dumpMemory(socexplorerplugin* theWrappedObject, unsigned int address, unsigned int count, QString file, const QString& format);
151 QString instance(socexplorerplugin* theWrappedObject);
152 152 QString instanceName(socexplorerplugin* theWrappedObject);
153 153 int isConnected(socexplorerplugin* theWrappedObject);
154 154 bool loadbin(socexplorerplugin* theWrappedObject, unsigned int address, QString file);
155 void makeGenericPyWrapper(socexplorerplugin* theWrappedObject);
156 155 bool memSet(socexplorerplugin* theWrappedObject, unsigned int address, int value, unsigned int count);
157 156 void postInstantiationTrigger(socexplorerplugin* theWrappedObject);
158 157 int registermenu(socexplorerplugin* theWrappedObject, QMenu* menu);
@@ -66,7 +66,7 void SocExplorerMainWindow::makeObjects(
66 66 socexplorerproxy::setMainWindow(this);
67 67 SocExplorerEngine::setMainWindow(this);
68 68 SocExplorerEngine::xmlModel()->scanXmlFiles();
69 this->regExplorer = new regsExplorer();
69 this->regExplorer = new RegsExplorer();
70 70 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
71 71 this->addPluginInterface(this->regExplorer);
72 72 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
@@ -74,7 +74,6 void SocExplorerMainWindow::makeObjects(
74 74 this->pluginManager = new dockablePluginManager();
75 75 this->toolpane = new toolBar;
76 76 this->p_about = new aboutsocexplorer();
77
78 77 }
79 78
80 79 void SocExplorerMainWindow::makeLayout()
@@ -132,7 +131,6 void SocExplorerMainWindow::addPluginInt
132 131 if(p_pluginGUIlist->count()!=0)
133 132 this->pluginsDockContainer->tabifyDockWidget(p_pluginGUIlist->last(),plugin);
134 133 p_pluginGUIlist->append(plugin);
135
136 134 }
137 135
138 136 void SocExplorerMainWindow::removePluginInterface(QDockWidget *plugin)
@@ -78,7 +78,7 private:
78 78 QSplitter* mainWidget;
79 79 PythonConsole* PythonConsoleInst;
80 80 dockablePluginManager* pluginManager;
81 regsExplorer* regExplorer;
81 RegsExplorer* regExplorer;
82 82 aboutsocexplorer* p_about;
83 83 QList<QDockWidget*>* p_pluginGUIlist;
84 84 };
@@ -1,30 +1,34
1 1 #include "regsexplorer.h"
2 #include "ui_regsexplorernew.h"
2 3 #include "socmodel.h"
3 4
4 regsExplorer::regsExplorer(QWidget *parent) :
5 QDockWidget(parent)
5 RegsExplorer::RegsExplorer(QWidget *parent) :
6 QDockWidget(parent),
7 ui(new Ui::RegsExplorerNew)
6 8 {
7 mainWidget = new QTabWidget;
8 cfg = new regsExplorerCfg;
9 socViewer = new SocRegsViewerNew(tr("No soc Detected"),this);
10 this->setWidget(this->mainWidget);
11 this->mainWidget->addTab(this->cfg,"Config");
12 this->mainWidget->addTab(this->socViewer,"View");
13 this->setWindowTitle(tr("Regs Explorer"));
9 ui->setupUi(this);
14 10 connect(SocExplorerEngine::self(),SIGNAL(enumDeviceAdded(socExplorerEnumDevice*)),this,SLOT(addDev(socExplorerEnumDevice*)));
11 delegate.device=NULL;
15 12 }
16 13
14 RegsExplorer::~RegsExplorer()
15 {
16 delete ui;
17 }
17 18
18 void regsExplorer::addDev(socExplorerEnumDevice *device)
19 void RegsExplorer::addDev(socExplorerEnumDevice *device)
20 {
21 if((delegate.device->sameSoc(device))||(delegate.device==NULL))
19 22 {
20 23 delegate.device = device;
21 24 peripheralWidget* peripheral=new peripheralWidget(device->name(),device->baseAddress(),&delegate,this);
22 this->socViewer->addPeripheral(peripheral);
25 this->ui->regsViewer->addPeripheral(peripheral);
23 26 peripheralModel periphM=SocExplorerEngine::xmlModel()->getPeripheral(device->name());
24 27 int startIndex,stopIndex;
25 28 QString desc;
26 29 QString name;
27 30 bool rw;
31 this->ui->regsViewer->setSocName(device->socName());
28 32 for(int i=0;i<periphM.registers.count();i++)
29 33 {
30 34 peripheral->addRegister(periphM.registers.at(i).name,device->baseAddress() + periphM.registers.at(i).offset);
@@ -38,13 +42,17 void regsExplorer::addDev(socExplorerEnu
38 42 peripheral->registerAt(i)->setBitFieldAttribute(startIndex,stopIndex,name,desc,rw);
39 43 }
40 44 }
41 // connect(peripheral,SIGNAL(readRegSig(qint32)),device,SLOT(readReg(qint32)));
42 // connect(peripheral,SIGNAL(writeRegSig(qint32,qint32)),device,SLOT(writeReg(qint32,qint32)));
43 // QCheckBox* chkbx = this->cfg->addDev(device);
44 // chkbx->setChecked(true);
45 // connect(chkbx,SIGNAL(toggled(bool)),peripheral,SLOT(setVisible(bool)));
45 }
46 46 }
47 47
48
49
50
48 void RegsExplorer::changeEvent(QEvent *e)
49 {
50 QDockWidget::changeEvent(e);
51 switch (e->type()) {
52 case QEvent::LanguageChange:
53 ui->retranslateUi(this);
54 break;
55 default:
56 break;
57 }
58 }
@@ -1,41 +1,16
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #ifndef REGSEXPLORER_H
23 #define REGSEXPLORER_H
1 #ifndef REGSEXPLORERNEW_H
2 #define REGSEXPLORERNEW_H
24 3
25 #include <QWidget>
26 #include <QTabWidget>
27 4 #include <QDockWidget>
28 #include "regsexplorercfg.h"
29 #include "regsviewer.h"
30 #include <QGridLayout>
31 5 #include <socexplorerengine.h>
32 6 #include <peripheralwidget.h>
33 #include <socregsviewer.h>
34 7 #include <socregsviewernew.h>
35 8
36
9 namespace Ui {
10 class RegsExplorerNew;
11 }
37 12
38 class regsExplorer : public QDockWidget
13 class RegsExplorer : public QDockWidget
39 14 {
40 15 Q_OBJECT
41 16 class regExplorerReadWriteDelegate: public peripheralWidget::readWriteProxy
@@ -47,20 +22,16 class regsExplorer : public QDockWidget
47 22 socExplorerEnumDevice* device;
48 23 };
49 24 public:
50 explicit regsExplorer(QWidget *parent = 0);
51
52 signals:
53
25 explicit RegsExplorer(QWidget *parent = 0);
26 ~RegsExplorer();
54 27 public slots:
55
56 28 void addDev(socExplorerEnumDevice* device);
29 protected:
30 void changeEvent(QEvent *e);
57 31
58 32 private:
59 QTabWidget* mainWidget;
60 regsExplorerCfg* cfg;
61 // socRegsViewer* socViewer;
62 SocRegsViewerNew* socViewer;
33 Ui::RegsExplorerNew *ui;
63 34 regExplorerReadWriteDelegate delegate;
64 35 };
65 36
66 #endif // REGSEXPLORER_H
37 #endif // REGSEXPLORERNEW_H
@@ -72,10 +72,8 SOURCES += main.cpp\
72 72 dockablepluginmanager.cpp \
73 73 toolbar.cpp \
74 74 toolbarcontainer.cpp \
75 regsExplorer/regsexplorer.cpp \
76 regsExplorer/regsviewer.cpp \
77 regsExplorer/regsexplorercfg.cpp \
78 aboutsocexplorer.cpp
75 aboutsocexplorer.cpp \
76 regsExplorer/regsexplorer.cpp
79 77
80 78 HEADERS += mainwindow.h \
81 79 PyWdgt/pythonconsole.h \
@@ -83,12 +81,10 HEADERS += mainwindow.h \
83 81 dockablepluginmanager.h \
84 82 toolbar.h \
85 83 toolbarcontainer.h \
86 regsExplorer/regsexplorer.h \
87 regsExplorer/regsviewer.h \
88 regsExplorer/regsexplorercfg.h \
89 84 socexplorer.h \
90 85 SocExplorerEngine/plugins/socexplorerplugin.h \
91 aboutsocexplorer.h
86 aboutsocexplorer.h \
87 regsExplorer/regsexplorer.h
92 88
93 89
94 90 include ( NicePyConsole/NicePyConsole.pri)
@@ -104,6 +100,8 unix{
104 100 TRANSLATIONS = ../translations/socexplorer_fr.ts \
105 101 ../translations/socexplorer_en.ts
106 102
103 FORMS += \
104 regsExplorer/regsexplorernew.ui
107 105
108 106
109 107
@@ -112,3 +110,4 TRANSLATIONS = ../translations/socexplor
112 110
113 111
114 112
113
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now