@@ -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 |
@@ -17,7 +17,7 TARGET = ApbUartPlugin$${DEBUG_EXT} | |||
|
17 | 17 | |
|
18 | 18 | DEFINES += PLUGIN=ApbUartPlugin |
|
19 | 19 | DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\" |
|
20 |
DEFINES += driver_Name="\"\\\"APB |
|
|
20 | DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\" | |
|
21 | 21 | DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\" |
|
22 | 22 | DEFINES += driver_Version="\"\\\"0.0.1"\\\"\" |
|
23 | 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 | 34 | QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString))); |
|
35 | 35 | QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget())); |
|
36 | 36 | QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run())); |
|
37 | QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop())); | |
|
37 | 38 | connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile())); |
|
38 | 39 | connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget())); |
|
39 |
connect(this->UI,SIGNAL(run()),this,SLOT( |
|
|
40 | connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun())); | |
|
40 | 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 | 142 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
141 | 143 | DSUBASEADDRESS = 0x90000000; |
|
142 | 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 | 167 | void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address) |
@@ -48,6 +48,8 public slots: | |||
|
48 | 48 | bool configureTarget(); |
|
49 | 49 | bool flashTarget(); |
|
50 | 50 | void run(); |
|
51 | void stop(); | |
|
52 | void toggleRun(); | |
|
51 | 53 | signals: |
|
52 | 54 | void updateInfo(elfparser* parser); |
|
53 | 55 | private: |
@@ -56,6 +58,7 private: | |||
|
56 | 58 | void writeSection(const QString& name); |
|
57 | 59 | dsu3pluginui* UI; |
|
58 | 60 | elfparser* elfparserInst; |
|
61 | bool running; | |
|
59 | 62 | }; |
|
60 | 63 | |
|
61 | 64 | #endif // DSU3PLUGIN_H |
@@ -12,6 +12,7 signals: | |||
|
12 | 12 | bool openFile(QString fileName); |
|
13 | 13 | bool loadFile(); |
|
14 | 14 | bool run(); |
|
15 | bool stop(); | |
|
15 | 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 | 38 | explicit dsu3pluginui(QWidget *parent = 0); |
|
39 | 39 | |
|
40 | 40 | public slots: |
|
41 | ||
|
41 | void setRunning(bool running); | |
|
42 | 42 | signals: |
|
43 | 43 | void openFile(); |
|
44 | 44 | void updateInfo(elfparser* parser); |
@@ -50,7 +50,6 private: | |||
|
50 | 50 | QPushButton* flashTargetQpb; |
|
51 | 51 | QPushButton* runQpb; |
|
52 | 52 | elfInfoWdgt* elfInfoWdgtInst; |
|
53 | ||
|
54 | 53 | }; |
|
55 | 54 | |
|
56 | 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 | 22 | #include "spwtcppacketserver.h" |
|
2 | 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 | 22 | #ifndef SPWTCPPACKETSERVER_H |
|
2 | 23 | #define SPWTCPPACKETSERVER_H |
|
3 | 24 |
@@ -23,12 +23,13 | |||
|
23 | 23 | #include "spwplugin.h" |
|
24 | 24 | #include "stardundeespw_usb.h" |
|
25 | 25 | #include <socexplorerproxy.h> |
|
26 | ||
|
27 |
spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent, |
|
|
26 | #include "spwpywrapper.h" | |
|
27 | spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false) | |
|
28 | 28 | { |
|
29 | 29 | Q_UNUSED(parent) |
|
30 | 30 | this->bridge = NULL; |
|
31 | 31 | this->scanDone = false; |
|
32 | this->pyObject = new spwPyWrapper(this); | |
|
32 | 33 | this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this); |
|
33 | 34 | this->bridgeSelector = new QComboBox(this); |
|
34 | 35 | this->mainLayout = new QGridLayout(this); |
@@ -82,6 +83,15 void spwplugin::bridgeSelectionChanged(c | |||
|
82 | 83 | this->bridge = new stardundeeSPW_USB(this); |
|
83 | 84 | this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2); |
|
84 | 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 | 101 | this->bridgeSelector->setDisabled(connected); |
|
92 | 102 | this->Connected = connected; |
|
93 | 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 | 38 | abstractspwbridge.h \ |
|
39 | 39 | spw.h \ |
|
40 | 40 | stardundeegui.h \ |
|
41 | SpwTcpPacketServer/spwtcppacketserver.h | |
|
41 | SpwTcpPacketServer/spwtcppacketserver.h \ | |
|
42 | spwpywrapper.h | |
|
42 | 43 | |
|
43 | 44 | |
|
44 | 45 | SOURCES += \ |
@@ -46,7 +47,8 SOURCES += \ | |||
|
46 | 47 | stardundeespw_usb.cpp \ |
|
47 | 48 | abstractspwbridge.cpp \ |
|
48 | 49 | stardundeegui.cpp \ |
|
49 | SpwTcpPacketServer/spwtcppacketserver.cpp | |
|
50 | SpwTcpPacketServer/spwtcppacketserver.cpp \ | |
|
51 | spwpywrapper.cpp | |
|
50 | 52 | |
|
51 | 53 | FORMS += \ |
|
52 | 54 | stardundeeGUI.ui \ |
@@ -6,8 +6,8 | |||
|
6 | 6 | <rect> |
|
7 | 7 | <x>0</x> |
|
8 | 8 | <y>0</y> |
|
9 |
<width> |
|
|
10 |
<height>2 |
|
|
9 | <width>397</width> | |
|
10 | <height>243</height> | |
|
11 | 11 | </rect> |
|
12 | 12 | </property> |
|
13 | 13 | <property name="windowTitle"> |
@@ -148,13 +148,39 | |||
|
148 | 148 | </property> |
|
149 | 149 | </widget> |
|
150 | 150 | </item> |
|
151 |
<item row=" |
|
|
151 | <item row="7" column="1"> | |
|
152 | 152 | <widget class="QPushButton" name="connectQpb"> |
|
153 | 153 | <property name="text"> |
|
154 | 154 | <string>Connect</string> |
|
155 | 155 | </property> |
|
156 | 156 | </widget> |
|
157 | 157 | </item> |
|
158 | <item row="6" column="1"> | |
|
159 | <widget class="QLineEdit" name="RMAPTimeoutLineEdit"> | |
|
160 | <property name="toolTip"> | |
|
161 | <string><html><head/><body><p>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.</p></body></html></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 | 184 | </layout> |
|
159 | 185 | </widget> |
|
160 | 186 | <resources/> |
@@ -35,6 +35,7 StarDundeeGUI::StarDundeeGUI(QWidget *pa | |||
|
35 | 35 | connect(this->ui->destKeyLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(destinationKeyChanged(QString))); |
|
36 | 36 | connect(this->ui->RMAPAddresslineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapAddressChanged(QString))); |
|
37 | 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 | 39 | connect(this->ui->connectQpb,SIGNAL(clicked()),this,SIGNAL(connectClicked())); |
|
39 | 40 | |
|
40 | 41 | } |
@@ -69,6 +70,11 QString StarDundeeGUI::getRmapKey() | |||
|
69 | 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 | 80 | void StarDundeeGUI::lock(bool lock) |
@@ -79,6 +85,7 void StarDundeeGUI::lock(bool lock) | |||
|
79 | 85 | this->ui->destKeyLineEdit->setDisabled(lock); |
|
80 | 86 | this->ui->RMAPAddresslineEdit->setDisabled(lock); |
|
81 | 87 | this->ui->RMAPKeylineEdit->setDisabled(lock); |
|
88 | this->ui->RMAPTimeoutLineEdit->setDisabled(lock); | |
|
82 | 89 | if(lock) |
|
83 | 90 | this->ui->connectQpb->setText("Disconnect"); |
|
84 | 91 | else |
@@ -105,3 +112,63 void StarDundeeGUI::updateAvailableBrick | |||
|
105 | 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 | 39 | QString getDestinationKey(); |
|
40 | 40 | QString getRmapAddress(); |
|
41 | 41 | QString getRmapKey(); |
|
42 | QString getRmapTimeout(); | |
|
42 | 43 | signals: |
|
43 | 44 | void brickSelectionChanged(int brickIndex); |
|
44 | 45 | void linkNumberSelectionChanged(int linkIndex); |
@@ -46,11 +47,18 signals: | |||
|
46 | 47 | void destinationKeyChanged(const QString & destKey); |
|
47 | 48 | void rmapAddressChanged(const QString & address); |
|
48 | 49 | void rmapKeyChanged(const QString & key); |
|
50 | void rmapTimeoutChanged(const QString & timeout); | |
|
49 | 51 | void connectClicked(); |
|
50 | 52 | public slots: |
|
51 | 53 | void lock(bool lock); |
|
52 | 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 | 62 | private: |
|
55 | 63 | Ui::StarDundeeUI *ui; |
|
56 | 64 | }; |
@@ -43,32 +43,37 void stardundeeSPW_USB::toggleBridgeConn | |||
|
43 | 43 | { |
|
44 | 44 | if(this->plugin->isConnected()) |
|
45 | 45 | { |
|
46 |
|
|
|
47 | { | |
|
48 | ((StarDundeeGUI*)this->p_GUI)->lock(false); | |
|
49 | emit setConnected(false); | |
|
50 | } | |
|
46 | this->disconnectBridge(); | |
|
51 | 47 | } |
|
52 | 48 | else |
|
53 | 49 | { |
|
54 |
|
|
|
55 | { | |
|
56 | ((StarDundeeGUI*)this->p_GUI)->lock(true); | |
|
57 | emit setConnected(true); | |
|
58 | } | |
|
50 | this->connectBridge(); | |
|
59 | 51 | } |
|
60 | 52 | } |
|
61 | 53 | |
|
62 | 54 | bool stardundeeSPW_USB::connectBridge() |
|
63 | 55 | { |
|
64 |
|
|
|
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 | 65 | bool stardundeeSPW_USB::disconnectBridge() |
|
68 | 66 | { |
|
69 |
|
|
|
67 | if(this->manager->disconnectBridge()) | |
|
68 | { | |
|
69 | ((StarDundeeGUI*)this->p_GUI)->lock(false); | |
|
70 | emit setConnected(false); | |
|
71 | return true; | |
|
72 | } | |
|
73 | return false; | |
|
70 | 74 | } |
|
71 | 75 | |
|
76 | ||
|
72 | 77 | int stardundeeSPW_USB::pushRMAPPacket(char *packet, int size) |
|
73 | 78 | { |
|
74 | 79 | return this->manager->sendPacket(packet,size); |
@@ -82,8 +87,12 unsigned int stardundeeSPW_USB::Write(un | |||
|
82 | 87 | int written=0; |
|
83 | 88 | SocExplorerEngine::message(this->plugin,"Enter Write function",2); |
|
84 | 89 | QProgressBar* progress=NULL; |
|
90 | SocExplorerAutoProgressBar autopb; | |
|
85 | 91 | if(count>RMAP_MAX_XFER_SIZE) |
|
92 | { | |
|
86 | 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 | 96 | //Quite stupide loop, I guess that I always get the number of byte I asked for! |
|
88 | 97 | while(count>=RMAP_MAX_XFER_SIZE) |
|
89 | 98 | { |
@@ -119,10 +128,10 unsigned int stardundeeSPW_USB::Write(un | |||
|
119 | 128 | qApp->processEvents(); |
|
120 | 129 | } |
|
121 | 130 | } |
|
122 | if(progress!=NULL) | |
|
123 | { | |
|
124 | SocExplorerEngine::deleteProgressBar(progress); | |
|
125 | } | |
|
131 | // if(progress!=NULL) | |
|
132 | // { | |
|
133 | // SocExplorerEngine::deleteProgressBar(progress); | |
|
134 | // } | |
|
126 | 135 | return written; |
|
127 | 136 | } |
|
128 | 137 | |
@@ -134,8 +143,12 unsigned int stardundeeSPW_USB::Read(uns | |||
|
134 | 143 | int transactionID = 0; |
|
135 | 144 | int read=0; |
|
136 | 145 | QProgressBar* progress=NULL; |
|
146 | SocExplorerAutoProgressBar autopb; | |
|
137 | 147 | if(count>RMAP_MAX_XFER_SIZE) |
|
148 | { | |
|
138 | 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 | 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 | 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 | 208 | qApp->processEvents(); |
|
196 | 209 | } |
|
197 | 210 | } |
|
198 | if(progress!=NULL) | |
|
199 | { | |
|
200 | SocExplorerEngine::deleteProgressBar(progress); | |
|
201 | } | |
|
211 | // if(progress!=NULL) | |
|
212 | // { | |
|
213 | // SocExplorerEngine::deleteProgressBar(progress); | |
|
214 | // } | |
|
202 | 215 | return read; |
|
203 | 216 | } |
|
204 | 217 | |
|
205 | 218 | void stardundeeSPW_USB::brickSelectionChanged(int brickIndex) |
|
206 | 219 | { |
|
207 | 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 | 224 | void stardundeeSPW_USB::linkNumberSelectionChanged(int linkIndex) |
|
212 | 225 | { |
|
213 | 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 | 230 | void stardundeeSPW_USB::linkSpeedSelectionChanged(const QString &linkSpeed) |
|
218 | 231 | { |
|
219 | 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 | 237 | void stardundeeSPW_USB::destinationKeyChanged(const QString &destKey) |
|
225 | 238 | { |
|
226 | 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 | 243 | void stardundeeSPW_USB::rmapAddressChanged(const QString &rmapaddress) |
|
231 | 244 | { |
|
232 | 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 | 249 | void stardundeeSPW_USB::rmapKeyChanged(const QString &key) |
|
237 | 250 | { |
|
238 | 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 | 268 | void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent) |
|
243 | 269 | { |
|
244 | 270 | this->p_GUI = new StarDundeeGUI(); |
@@ -251,12 +277,23 void stardundeeSPW_USB::makeGUI(socexplo | |||
|
251 | 277 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(destinationKeyChanged(QString)),this,SLOT(destinationKeyChanged(QString))); |
|
252 | 278 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapAddressChanged(QString)),this,SLOT(rmapAddressChanged(QString))); |
|
253 | 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 | 282 | this->brickSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getBrickSelection()); |
|
255 | 283 | this->linkNumberSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkNumberSelection()); |
|
256 | 284 | this->linkSpeedSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkSpeedSelection()); |
|
257 | 285 | this->destinationKeyChanged(((StarDundeeGUI*)this->p_GUI)->getDestinationKey()); |
|
258 | 286 | this->rmapAddressChanged(((StarDundeeGUI*)this->p_GUI)->getRmapAddress()); |
|
259 | 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 | 343 | SocExplorerEngine::message(this->plugin,"It's a SPW packet",2); |
|
307 | 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 | 347 | if(buffer[1]==(char)SPW_PROTO_ID_RMAP) //RMAP packet |
|
311 | 348 | { |
|
312 | 349 | SocExplorerEngine::message(this->plugin,"Got RMAP packet",2); |
@@ -368,7 +405,7 void stardundeeSPW_USB_Manager::run() | |||
|
368 | 405 | this->brickList = list; |
|
369 | 406 | emit updateAvailableBrickCount(this->brickList); |
|
370 | 407 | } |
|
371 |
sleep( |
|
|
408 | usleep(RMAPtimeout/2); | |
|
372 | 409 | } |
|
373 | 410 | usleep(1000); |
|
374 | 411 | } |
@@ -96,6 +96,15 public: | |||
|
96 | 96 | |
|
97 | 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 | 108 | public slots: |
|
100 | 109 | void toggleBridgeConnection(); |
|
101 | 110 | bool connectBridge(); |
@@ -109,6 +118,7 public slots: | |||
|
109 | 118 | void destinationKeyChanged(const QString & destKey); |
|
110 | 119 | void rmapAddressChanged(const QString & rmapaddress); |
|
111 | 120 | void rmapKeyChanged(const QString & key); |
|
121 | void rmapTimeoutChanged(const QString & timeout); | |
|
112 | 122 | private: |
|
113 | 123 | void makeGUI(socexplorerplugin *parent); |
|
114 | 124 | stardundeeSPW_USB_Manager* manager; |
General Comments 0
You need to be logged in to leave comments.
Login now