##// END OF EJS Templates
Added stop function to dsu3plugin...
jeandet -
r14:f4bd616a53e5 default
parent child
Show More
@@ -0,0 +1,27
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, 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 3 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@member.fsf.org
21 ----------------------------------------------------------------------------*/
22 #include "spwpywrapper.h"
23
24 spwPyWrapper::spwPyWrapper(socexplorerplugin *parent) :
25 genericPySysdriver(parent)
26 {
27 }
@@ -0,0 +1,25
1 #ifndef SPWPYWRAPPER_H
2 #define SPWPYWRAPPER_H
3 #include <genericPySysdriver.h>
4
5 class spwPyWrapper : public genericPySysdriver
6 {
7 Q_OBJECT
8 public:
9 explicit spwPyWrapper(socexplorerplugin *parent = 0);
10
11 signals:
12 bool connectBridge();
13 bool disconnectBridge();
14 void StarDundeeSelectBrick(int brickIndex);
15 void StarDundeeSelectLinkNumber(int linkIndex);
16 void StarDundeeSelectLinkSpeed(int linkSpeed);
17 void StarDundeeSetDestinationKey(const QString & destKey);
18 void StarDundeeSetRmapAddress(const QString & address);
19 void StarDundeeSetRmapKey(const QString & key);
20 void StarDundeeSetRmapTimeout(const QString & timeout);
21 public slots:
22
23 };
24
25 #endif // SPWPYWRAPPER_H
@@ -5,3 +5,4 moc_*
5 *.so*
5 *.so*
6 ui_*.h
6 ui_*.h
7 Makefile
7 Makefile
8 qrc_*.cpp
@@ -17,7 +17,7 TARGET = ApbUartPlugin$${DEBUG_EXT}
17
17
18 DEFINES += PLUGIN=ApbUartPlugin
18 DEFINES += PLUGIN=ApbUartPlugin
19 DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\"
19 DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\"
20 DEFINES += driver_Name="\"\\\"APB UART PLUGIN"\\\"\"
20 DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\"
21 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\"
21 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\"
22 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
22 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
23 DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\"
23 DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\"
@@ -34,10 +34,12 dsu3plugin::dsu3plugin(QWidget *parent):
34 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString)));
34 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString)));
35 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
35 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
36 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
36 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
37 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
37 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
38 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
38 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
39 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
39 connect(this->UI,SIGNAL(run()),this,SLOT(run()));
40 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
40 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
41 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
42 this->running = false;
41 }
43 }
42
44
43
45
@@ -140,6 +142,26 void dsu3plugin::run()
140 if(DSUBASEADDRESS == (unsigned int)-1)
142 if(DSUBASEADDRESS == (unsigned int)-1)
141 DSUBASEADDRESS = 0x90000000;
143 DSUBASEADDRESS = 0x90000000;
142 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
144 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
145 this->running = true;
146 this->UI->setRunning(true);
147 }
148
149 void dsu3plugin::stop()
150 {
151 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
152 if(DSUBASEADDRESS == (unsigned int)-1)
153 DSUBASEADDRESS = 0x90000000;
154 WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020);
155 this->running = false;
156 this->UI->setRunning(false);
157 }
158
159 void dsu3plugin::toggleRun()
160 {
161 if(this->running)
162 this->stop();
163 else
164 this->run();
143 }
165 }
144
166
145 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
167 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
@@ -48,6 +48,8 public slots:
48 bool configureTarget();
48 bool configureTarget();
49 bool flashTarget();
49 bool flashTarget();
50 void run();
50 void run();
51 void stop();
52 void toggleRun();
51 signals:
53 signals:
52 void updateInfo(elfparser* parser);
54 void updateInfo(elfparser* parser);
53 private:
55 private:
@@ -56,6 +58,7 private:
56 void writeSection(const QString& name);
58 void writeSection(const QString& name);
57 dsu3pluginui* UI;
59 dsu3pluginui* UI;
58 elfparser* elfparserInst;
60 elfparser* elfparserInst;
61 bool running;
59 };
62 };
60
63
61 #endif // DSU3PLUGIN_H
64 #endif // DSU3PLUGIN_H
@@ -12,6 +12,7 signals:
12 bool openFile(QString fileName);
12 bool openFile(QString fileName);
13 bool loadFile();
13 bool loadFile();
14 bool run();
14 bool run();
15 bool stop();
15 public slots:
16 public slots:
16
17
17 };
18 };
@@ -42,6 +42,13 dsu3pluginui::dsu3pluginui(QWidget *pare
42
42
43 }
43 }
44
44
45 void dsu3pluginui::setRunning(bool running)
46 {
47 if(running)
48 this->runQpb->setText("Stop");
49 else
50 this->runQpb->setText("Run");
51 }
45
52
46
53
47
54
@@ -52,3 +59,4 dsu3pluginui::dsu3pluginui(QWidget *pare
52
59
53
60
54
61
62
@@ -38,7 +38,7 public:
38 explicit dsu3pluginui(QWidget *parent = 0);
38 explicit dsu3pluginui(QWidget *parent = 0);
39
39
40 public slots:
40 public slots:
41
41 void setRunning(bool running);
42 signals:
42 signals:
43 void openFile();
43 void openFile();
44 void updateInfo(elfparser* parser);
44 void updateInfo(elfparser* parser);
@@ -50,7 +50,6 private:
50 QPushButton* flashTargetQpb;
50 QPushButton* flashTargetQpb;
51 QPushButton* runQpb;
51 QPushButton* runQpb;
52 elfInfoWdgt* elfInfoWdgtInst;
52 elfInfoWdgt* elfInfoWdgtInst;
53
54 };
53 };
55
54
56 #endif // DSU3PLUGINUI_H
55 #endif // DSU3PLUGINUI_H
@@ -1,3 +1,24
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, 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 3 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@member.fsf.org
21 ----------------------------------------------------------------------------*/
1 #include "spwtcppacketserver.h"
22 #include "spwtcppacketserver.h"
2 #include "ui_spwtcppacketserver.h"
23 #include "ui_spwtcppacketserver.h"
3
24
@@ -1,3 +1,24
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, 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 3 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@member.fsf.org
21 ----------------------------------------------------------------------------*/
1 #ifndef SPWTCPPACKETSERVER_H
22 #ifndef SPWTCPPACKETSERVER_H
2 #define SPWTCPPACKETSERVER_H
23 #define SPWTCPPACKETSERVER_H
3
24
@@ -23,12 +23,13
23 #include "spwplugin.h"
23 #include "spwplugin.h"
24 #include "stardundeespw_usb.h"
24 #include "stardundeespw_usb.h"
25 #include <socexplorerproxy.h>
25 #include <socexplorerproxy.h>
26
26 #include "spwpywrapper.h"
27 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true)
27 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
28 {
28 {
29 Q_UNUSED(parent)
29 Q_UNUSED(parent)
30 this->bridge = NULL;
30 this->bridge = NULL;
31 this->scanDone = false;
31 this->scanDone = false;
32 this->pyObject = new spwPyWrapper(this);
32 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
33 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
33 this->bridgeSelector = new QComboBox(this);
34 this->bridgeSelector = new QComboBox(this);
34 this->mainLayout = new QGridLayout(this);
35 this->mainLayout = new QGridLayout(this);
@@ -82,6 +83,15 void spwplugin::bridgeSelectionChanged(c
82 this->bridge = new stardundeeSPW_USB(this);
83 this->bridge = new stardundeeSPW_USB(this);
83 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
84 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
84 connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool)));
85 connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool)));
86 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectBrick(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectBrick(int)));
87 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkNumber(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkNumber(int)));
88 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkSpeed(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkSpeed(int)));
89 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetDestinationKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationKey(QString)));
90 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapAddress(QString)));
91 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapKey(QString)));
92 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapTimeout(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapTimeout(QString)));
93 connect(((spwPyWrapper*)this->pyObject),SIGNAL(connectBridge()),((stardundeeSPW_USB*)bridge),SLOT(connectBridge()));
94 connect(((spwPyWrapper*)this->pyObject),SIGNAL(disconnectBridge()),((stardundeeSPW_USB*)bridge),SLOT(disconnectBridge()));
85 }
95 }
86
96
87 }
97 }
@@ -91,6 +101,11 void spwplugin::setConnected(bool connec
91 this->bridgeSelector->setDisabled(connected);
101 this->bridgeSelector->setDisabled(connected);
92 this->Connected = connected;
102 this->Connected = connected;
93 emit activateSig(connected);
103 emit activateSig(connected);
104 if(!this->scanDone)
105 {
106 socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN");
107 this->scanDone=true;
108 }
94 }
109 }
95
110
96
111
@@ -38,7 +38,8 HEADERS += \
38 abstractspwbridge.h \
38 abstractspwbridge.h \
39 spw.h \
39 spw.h \
40 stardundeegui.h \
40 stardundeegui.h \
41 SpwTcpPacketServer/spwtcppacketserver.h
41 SpwTcpPacketServer/spwtcppacketserver.h \
42 spwpywrapper.h
42
43
43
44
44 SOURCES += \
45 SOURCES += \
@@ -46,7 +47,8 SOURCES += \
46 stardundeespw_usb.cpp \
47 stardundeespw_usb.cpp \
47 abstractspwbridge.cpp \
48 abstractspwbridge.cpp \
48 stardundeegui.cpp \
49 stardundeegui.cpp \
49 SpwTcpPacketServer/spwtcppacketserver.cpp
50 SpwTcpPacketServer/spwtcppacketserver.cpp \
51 spwpywrapper.cpp
50
52
51 FORMS += \
53 FORMS += \
52 stardundeeGUI.ui \
54 stardundeeGUI.ui \
@@ -6,8 +6,8
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>778</width>
9 <width>397</width>
10 <height>271</height>
10 <height>243</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
@@ -148,13 +148,39
148 </property>
148 </property>
149 </widget>
149 </widget>
150 </item>
150 </item>
151 <item row="6" column="1">
151 <item row="7" column="1">
152 <widget class="QPushButton" name="connectQpb">
152 <widget class="QPushButton" name="connectQpb">
153 <property name="text">
153 <property name="text">
154 <string>Connect</string>
154 <string>Connect</string>
155 </property>
155 </property>
156 </widget>
156 </widget>
157 </item>
157 </item>
158 <item row="6" column="1">
159 <widget class="QLineEdit" name="RMAPTimeoutLineEdit">
160 <property name="toolTip">
161 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the RMAP timeout, when waiting for a RMAP answer the driver will give up after this time if it doesn't get any answer.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
162 </property>
163 <property name="inputMethodHints">
164 <set>Qt::ImhDigitsOnly</set>
165 </property>
166 <property name="inputMask">
167 <string comment="DDdd;"/>
168 </property>
169 <property name="text">
170 <string>500</string>
171 </property>
172 <property name="maxLength">
173 <number>5</number>
174 </property>
175 </widget>
176 </item>
177 <item row="6" column="0">
178 <widget class="QLabel" name="RMAPTimeoutLbl">
179 <property name="text">
180 <string>RMAP timeout(ms)</string>
181 </property>
182 </widget>
183 </item>
158 </layout>
184 </layout>
159 </widget>
185 </widget>
160 <resources/>
186 <resources/>
@@ -35,6 +35,7 StarDundeeGUI::StarDundeeGUI(QWidget *pa
35 connect(this->ui->destKeyLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(destinationKeyChanged(QString)));
35 connect(this->ui->destKeyLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(destinationKeyChanged(QString)));
36 connect(this->ui->RMAPAddresslineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapAddressChanged(QString)));
36 connect(this->ui->RMAPAddresslineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapAddressChanged(QString)));
37 connect(this->ui->RMAPKeylineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapKeyChanged(QString)));
37 connect(this->ui->RMAPKeylineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapKeyChanged(QString)));
38 connect(this->ui->RMAPTimeoutLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapTimeoutChanged(QString)));
38 connect(this->ui->connectQpb,SIGNAL(clicked()),this,SIGNAL(connectClicked()));
39 connect(this->ui->connectQpb,SIGNAL(clicked()),this,SIGNAL(connectClicked()));
39
40
40 }
41 }
@@ -69,6 +70,11 QString StarDundeeGUI::getRmapKey()
69 return ui->RMAPKeylineEdit->text();
70 return ui->RMAPKeylineEdit->text();
70 }
71 }
71
72
73 QString StarDundeeGUI::getRmapTimeout()
74 {
75 return ui->RMAPTimeoutLineEdit->text();
76 }
77
72
78
73
79
74 void StarDundeeGUI::lock(bool lock)
80 void StarDundeeGUI::lock(bool lock)
@@ -79,6 +85,7 void StarDundeeGUI::lock(bool lock)
79 this->ui->destKeyLineEdit->setDisabled(lock);
85 this->ui->destKeyLineEdit->setDisabled(lock);
80 this->ui->RMAPAddresslineEdit->setDisabled(lock);
86 this->ui->RMAPAddresslineEdit->setDisabled(lock);
81 this->ui->RMAPKeylineEdit->setDisabled(lock);
87 this->ui->RMAPKeylineEdit->setDisabled(lock);
88 this->ui->RMAPTimeoutLineEdit->setDisabled(lock);
82 if(lock)
89 if(lock)
83 this->ui->connectQpb->setText("Disconnect");
90 this->ui->connectQpb->setText("Disconnect");
84 else
91 else
@@ -105,3 +112,63 void StarDundeeGUI::updateAvailableBrick
105 count>>=1;
112 count>>=1;
106 }
113 }
107 }
114 }
115
116 void StarDundeeGUI::setRmapTimeout(const QString &timeout)
117 {
118 this->ui->RMAPTimeoutLineEdit->setText(timeout);
119 }
120
121 void StarDundeeGUI::selectBrick(int brickIndex)
122 {
123 if(brickIndex>=0&& brickIndex<this->ui->selectBrickCmbx->count())
124 {
125 this->ui->selectBrickCmbx->setCurrentIndex(brickIndex);
126 }
127 }
128
129 void StarDundeeGUI::selectLinkNumber(int linkNumber)
130 {
131 if(linkNumber==1 || linkNumber==2)
132 {
133 this->ui->selectLinkCmbx->setCurrentIndex(linkNumber-1);
134 }
135 }
136
137 void StarDundeeGUI::selectLinkSpeed(int linkSpeed)
138 {
139 #define MHz *(1000*1000)
140 if(linkSpeed==10 MHz)
141 {
142 this->ui->selectLinkCmbx->setCurrentIndex(0);
143 }
144 }
145
146 void StarDundeeGUI::setDestinationKey(const QString &destKey)
147 {
148 bool ok;
149 int Key=destKey.toInt(&ok,10);
150 if(ok)
151 {
152 this->ui->destKeyLineEdit->setText(destKey);
153 }
154 }
155
156 void StarDundeeGUI::setRmapAddress(const QString &address)
157 {
158 bool ok;
159 int tmp=address.toInt(&ok,10);
160 if(ok)
161 {
162 this->ui->RMAPAddresslineEdit->setText(address);
163 }
164 }
165
166 void StarDundeeGUI::setRmapKey(const QString &key)
167 {
168 bool ok;
169 int tmp=key.toInt(&ok,10);
170 if(ok)
171 {
172 this->ui->RMAPKeylineEdit->setText(key);
173 }
174 }
@@ -39,6 +39,7 public:
39 QString getDestinationKey();
39 QString getDestinationKey();
40 QString getRmapAddress();
40 QString getRmapAddress();
41 QString getRmapKey();
41 QString getRmapKey();
42 QString getRmapTimeout();
42 signals:
43 signals:
43 void brickSelectionChanged(int brickIndex);
44 void brickSelectionChanged(int brickIndex);
44 void linkNumberSelectionChanged(int linkIndex);
45 void linkNumberSelectionChanged(int linkIndex);
@@ -46,11 +47,18 signals:
46 void destinationKeyChanged(const QString & destKey);
47 void destinationKeyChanged(const QString & destKey);
47 void rmapAddressChanged(const QString & address);
48 void rmapAddressChanged(const QString & address);
48 void rmapKeyChanged(const QString & key);
49 void rmapKeyChanged(const QString & key);
50 void rmapTimeoutChanged(const QString & timeout);
49 void connectClicked();
51 void connectClicked();
50 public slots:
52 public slots:
51 void lock(bool lock);
53 void lock(bool lock);
52 void updateAvailableBrickCount(int count);
54 void updateAvailableBrickCount(int count);
53
55 void selectBrick(int brickIndex);
56 void selectLinkNumber(int linkIndex);
57 void selectLinkSpeed(int linkSpeed);
58 void setDestinationKey(const QString & destKey);
59 void setRmapAddress(const QString & address);
60 void setRmapKey(const QString & key);
61 void setRmapTimeout(const QString & timeout);
54 private:
62 private:
55 Ui::StarDundeeUI *ui;
63 Ui::StarDundeeUI *ui;
56 };
64 };
@@ -43,31 +43,36 void stardundeeSPW_USB::toggleBridgeConn
43 {
43 {
44 if(this->plugin->isConnected())
44 if(this->plugin->isConnected())
45 {
45 {
46 if(this->disconnectBridge())
46 this->disconnectBridge();
47 {
48 ((StarDundeeGUI*)this->p_GUI)->lock(false);
49 emit setConnected(false);
50 }
51 }
47 }
52 else
48 else
53 {
49 {
54 if(this->connectBridge())
50 this->connectBridge();
55 {
56 ((StarDundeeGUI*)this->p_GUI)->lock(true);
57 emit setConnected(true);
58 }
59 }
51 }
60 }
52 }
61
53
62 bool stardundeeSPW_USB::connectBridge()
54 bool stardundeeSPW_USB::connectBridge()
63 {
55 {
64 return this->manager->connectBridge();
56 if(this->manager->connectBridge())
57 {
58 ((StarDundeeGUI*)this->p_GUI)->lock(true);
59 emit setConnected(true);
60 return true;
61 }
62 return false;
65 }
63 }
66
64
67 bool stardundeeSPW_USB::disconnectBridge()
65 bool stardundeeSPW_USB::disconnectBridge()
68 {
66 {
69 return this->manager->disconnectBridge();
67 if(this->manager->disconnectBridge())
68 {
69 ((StarDundeeGUI*)this->p_GUI)->lock(false);
70 emit setConnected(false);
71 return true;
70 }
72 }
73 return false;
74 }
75
71
76
72 int stardundeeSPW_USB::pushRMAPPacket(char *packet, int size)
77 int stardundeeSPW_USB::pushRMAPPacket(char *packet, int size)
73 {
78 {
@@ -82,8 +87,12 unsigned int stardundeeSPW_USB::Write(un
82 int written=0;
87 int written=0;
83 SocExplorerEngine::message(this->plugin,"Enter Write function",2);
88 SocExplorerEngine::message(this->plugin,"Enter Write function",2);
84 QProgressBar* progress=NULL;
89 QProgressBar* progress=NULL;
90 SocExplorerAutoProgressBar autopb;
85 if(count>RMAP_MAX_XFER_SIZE)
91 if(count>RMAP_MAX_XFER_SIZE)
92 {
86 progress= SocExplorerEngine::getProgressBar("Writing on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
93 progress= SocExplorerEngine::getProgressBar("Writing on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
94 autopb.setProgressBar(progress);
95 }
87 //Quite stupide loop, I guess that I always get the number of byte I asked for!
96 //Quite stupide loop, I guess that I always get the number of byte I asked for!
88 while(count>=RMAP_MAX_XFER_SIZE)
97 while(count>=RMAP_MAX_XFER_SIZE)
89 {
98 {
@@ -119,10 +128,10 unsigned int stardundeeSPW_USB::Write(un
119 qApp->processEvents();
128 qApp->processEvents();
120 }
129 }
121 }
130 }
122 if(progress!=NULL)
131 // if(progress!=NULL)
123 {
132 // {
124 SocExplorerEngine::deleteProgressBar(progress);
133 // SocExplorerEngine::deleteProgressBar(progress);
125 }
134 // }
126 return written;
135 return written;
127 }
136 }
128
137
@@ -134,8 +143,12 unsigned int stardundeeSPW_USB::Read(uns
134 int transactionID = 0;
143 int transactionID = 0;
135 int read=0;
144 int read=0;
136 QProgressBar* progress=NULL;
145 QProgressBar* progress=NULL;
146 SocExplorerAutoProgressBar autopb;
137 if(count>RMAP_MAX_XFER_SIZE)
147 if(count>RMAP_MAX_XFER_SIZE)
148 {
138 progress= SocExplorerEngine::getProgressBar("Reading on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
149 progress= SocExplorerEngine::getProgressBar("Reading on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
150 autopb.setProgressBar(progress);
151 }
139 SocExplorerEngine::message(this->plugin,QString("Enter read function, count=%1, RMAP_MAX_XFER_SIZE=%2").arg(count).arg(RMAP_MAX_XFER_SIZE),2);
152 SocExplorerEngine::message(this->plugin,QString("Enter read function, count=%1, RMAP_MAX_XFER_SIZE=%2").arg(count).arg(RMAP_MAX_XFER_SIZE),2);
140
153
141 //Quite stupide loop, I guess that I always get the number of byte I asked for!
154 //Quite stupide loop, I guess that I always get the number of byte I asked for!
@@ -195,50 +208,63 unsigned int stardundeeSPW_USB::Read(uns
195 qApp->processEvents();
208 qApp->processEvents();
196 }
209 }
197 }
210 }
198 if(progress!=NULL)
211 // if(progress!=NULL)
199 {
212 // {
200 SocExplorerEngine::deleteProgressBar(progress);
213 // SocExplorerEngine::deleteProgressBar(progress);
201 }
214 // }
202 return read;
215 return read;
203 }
216 }
204
217
205 void stardundeeSPW_USB::brickSelectionChanged(int brickIndex)
218 void stardundeeSPW_USB::brickSelectionChanged(int brickIndex)
206 {
219 {
207 this->manager->selectedBrick = brickIndex-1;
220 this->manager->selectedBrick = brickIndex-1;
208 SocExplorerEngine::message(plugin,QString("Changing brick index: %1").arg(manager->selectedBrick));
221 SocExplorerEngine::message(plugin,QString("Changing brick index: %1").arg(manager->selectedBrick),1);
209 }
222 }
210
223
211 void stardundeeSPW_USB::linkNumberSelectionChanged(int linkIndex)
224 void stardundeeSPW_USB::linkNumberSelectionChanged(int linkIndex)
212 {
225 {
213 this->manager->linkNumber = linkIndex + 1;
226 this->manager->linkNumber = linkIndex + 1;
214 SocExplorerEngine::message(plugin,QString("Changing Link Number: %1").arg(manager->linkNumber));
227 SocExplorerEngine::message(plugin,QString("Changing Link Number: %1").arg(manager->linkNumber),1);
215 }
228 }
216
229
217 void stardundeeSPW_USB::linkSpeedSelectionChanged(const QString &linkSpeed)
230 void stardundeeSPW_USB::linkSpeedSelectionChanged(const QString &linkSpeed)
218 {
231 {
219 this->manager->linkSpeed = linkSpeed.toInt();
232 this->manager->linkSpeed = linkSpeed.toInt();
220
233
221 SocExplorerEngine::message(plugin,QString("Changing Link Speed: %1").arg(manager->linkSpeed));
234 SocExplorerEngine::message(plugin,QString("Changing Link Speed: %1").arg(manager->linkSpeed),1);
222 }
235 }
223
236
224 void stardundeeSPW_USB::destinationKeyChanged(const QString &destKey)
237 void stardundeeSPW_USB::destinationKeyChanged(const QString &destKey)
225 {
238 {
226 this->manager->destinationKey = destKey.toInt();
239 this->manager->destinationKey = destKey.toInt();
227 SocExplorerEngine::message(plugin,QString("Changing Destination Key: %1").arg(manager->destinationKey));
240 SocExplorerEngine::message(plugin,QString("Changing Destination Key: %1").arg(manager->destinationKey),1);
228 }
241 }
229
242
230 void stardundeeSPW_USB::rmapAddressChanged(const QString &rmapaddress)
243 void stardundeeSPW_USB::rmapAddressChanged(const QString &rmapaddress)
231 {
244 {
232 this->manager->rmapAddress = rmapaddress.toInt();
245 this->manager->rmapAddress = rmapaddress.toInt();
233 SocExplorerEngine::message(plugin,QString("Changing RMAP address: %1").arg(manager->rmapAddress));
246 SocExplorerEngine::message(plugin,QString("Changing RMAP address: %1").arg(manager->rmapAddress),1);
234 }
247 }
235
248
236 void stardundeeSPW_USB::rmapKeyChanged(const QString &key)
249 void stardundeeSPW_USB::rmapKeyChanged(const QString &key)
237 {
250 {
238 this->manager->rmapKey = key.toInt();
251 this->manager->rmapKey = key.toInt();
239 SocExplorerEngine::message(plugin,QString("Changing RMAP Key: %1").arg(manager->rmapKey));
252 SocExplorerEngine::message(plugin,QString("Changing RMAP Key: %1").arg(manager->rmapKey),1);
240 }
253 }
241
254
255 void stardundeeSPW_USB::rmapTimeoutChanged(const QString &timeout)
256 {
257 int tim=timeout.toInt();
258 if(tim<50)
259 {
260 tim = 50;
261 ((StarDundeeGUI*)this->p_GUI)->setRmapTimeout(QString("%1").arg(tim));
262 }
263 this->manager->RMAPtimeout = tim;
264 SocExplorerEngine::message(plugin,QString("Changing RMAP Timeout: %1").arg(manager->RMAPtimeout),1);
265 }
266
267
242 void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent)
268 void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent)
243 {
269 {
244 this->p_GUI = new StarDundeeGUI();
270 this->p_GUI = new StarDundeeGUI();
@@ -251,12 +277,23 void stardundeeSPW_USB::makeGUI(socexplo
251 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(destinationKeyChanged(QString)),this,SLOT(destinationKeyChanged(QString)));
277 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(destinationKeyChanged(QString)),this,SLOT(destinationKeyChanged(QString)));
252 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapAddressChanged(QString)),this,SLOT(rmapAddressChanged(QString)));
278 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapAddressChanged(QString)),this,SLOT(rmapAddressChanged(QString)));
253 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapKeyChanged(QString)),this,SLOT(rmapKeyChanged(QString)));
279 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapKeyChanged(QString)),this,SLOT(rmapKeyChanged(QString)));
280 connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapTimeoutChanged(QString)),this,SLOT(rmapTimeoutChanged(QString)));
281
254 this->brickSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getBrickSelection());
282 this->brickSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getBrickSelection());
255 this->linkNumberSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkNumberSelection());
283 this->linkNumberSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkNumberSelection());
256 this->linkSpeedSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkSpeedSelection());
284 this->linkSpeedSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkSpeedSelection());
257 this->destinationKeyChanged(((StarDundeeGUI*)this->p_GUI)->getDestinationKey());
285 this->destinationKeyChanged(((StarDundeeGUI*)this->p_GUI)->getDestinationKey());
258 this->rmapAddressChanged(((StarDundeeGUI*)this->p_GUI)->getRmapAddress());
286 this->rmapAddressChanged(((StarDundeeGUI*)this->p_GUI)->getRmapAddress());
259 this->rmapKeyChanged(((StarDundeeGUI*)this->p_GUI)->getRmapKey());
287 this->rmapKeyChanged(((StarDundeeGUI*)this->p_GUI)->getRmapKey());
288 this->rmapTimeoutChanged(((StarDundeeGUI*)this->p_GUI)->getRmapTimeout());
289
290 connect(this,SIGNAL(SelectBrick(int)),((StarDundeeGUI*)this->p_GUI),SLOT(selectBrick(int)));
291 connect(this,SIGNAL(SelectLinkNumber(int)),((StarDundeeGUI*)this->p_GUI),SLOT(selectLinkNumber(int)));
292 connect(this,SIGNAL(SelectLinkSpeed(int)),((StarDundeeGUI*)this->p_GUI),SLOT(selectLinkSpeed(int)));
293 connect(this,SIGNAL(SetDestinationKey(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setDestinationKey(QString)));
294 connect(this,SIGNAL(SetRmapAddress(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setRmapAddress(QString)));
295 connect(this,SIGNAL(SetRmapKey(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setRmapKey(QString)));
296 connect(this,SIGNAL(SetRmapTimeout(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setRmapTimeout(QString)));
260
297
261 }
298 }
262
299
@@ -306,7 +343,7 void stardundeeSPW_USB_Manager::run()
306 SocExplorerEngine::message(this->plugin,"It's a SPW packet",2);
343 SocExplorerEngine::message(this->plugin,"It's a SPW packet",2);
307 if(USBSpaceWire_GetReadEOPStatus(&properties, 0)== SPACEWIRE_USB_EOP)
344 if(USBSpaceWire_GetReadEOPStatus(&properties, 0)== SPACEWIRE_USB_EOP)
308 {
345 {
309 SocExplorerEngine::message(this->plugin,"Got end of packet");
346 SocExplorerEngine::message(this->plugin,"Got end of packet",2);
310 if(buffer[1]==(char)SPW_PROTO_ID_RMAP) //RMAP packet
347 if(buffer[1]==(char)SPW_PROTO_ID_RMAP) //RMAP packet
311 {
348 {
312 SocExplorerEngine::message(this->plugin,"Got RMAP packet",2);
349 SocExplorerEngine::message(this->plugin,"Got RMAP packet",2);
@@ -368,7 +405,7 void stardundeeSPW_USB_Manager::run()
368 this->brickList = list;
405 this->brickList = list;
369 emit updateAvailableBrickCount(this->brickList);
406 emit updateAvailableBrickCount(this->brickList);
370 }
407 }
371 sleep(1);
408 usleep(RMAPtimeout/2);
372 }
409 }
373 usleep(1000);
410 usleep(1000);
374 }
411 }
@@ -96,6 +96,15 public:
96
96
97 signals:
97 signals:
98
98
99 void setRmapTimeout(const QString & timeout);
100 void SelectBrick(int brickIndex);
101 void SelectLinkNumber(int linkIndex);
102 void SelectLinkSpeed(int linkSpeed);
103 void SetDestinationKey(const QString & destKey);
104 void SetRmapAddress(const QString & address);
105 void SetRmapKey(const QString & key);
106 void SetRmapTimeout(const QString & timeout);
107
99 public slots:
108 public slots:
100 void toggleBridgeConnection();
109 void toggleBridgeConnection();
101 bool connectBridge();
110 bool connectBridge();
@@ -109,6 +118,7 public slots:
109 void destinationKeyChanged(const QString & destKey);
118 void destinationKeyChanged(const QString & destKey);
110 void rmapAddressChanged(const QString & rmapaddress);
119 void rmapAddressChanged(const QString & rmapaddress);
111 void rmapKeyChanged(const QString & key);
120 void rmapKeyChanged(const QString & key);
121 void rmapTimeoutChanged(const QString & timeout);
112 private:
122 private:
113 void makeGUI(socexplorerplugin *parent);
123 void makeGUI(socexplorerplugin *parent);
114 stardundeeSPW_USB_Manager* manager;
124 stardundeeSPW_USB_Manager* manager;
General Comments 0
You need to be logged in to leave comments. Login now