@@ -1,3 +1,7 | |||||
1 | syntax: glob |
|
1 | syntax: glob | |
2 | *.pro.user |
|
2 | *.pro.user | |
3 | *.o |
|
3 | *.o | |
|
4 | moc_* | |||
|
5 | *.so* | |||
|
6 | ui_*.h | |||
|
7 | Makefile |
@@ -1,198 +1,198 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "APBUARTPLUGIN.h" |
|
22 | #include "APBUARTPLUGIN.h" | |
23 | #include <socexplorerengine.h> |
|
23 | #include <socexplorerengine.h> | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent) |
|
26 | ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent) | |
27 | { |
|
27 | { | |
28 | this->UI = new ApbUartPluginUi(); |
|
28 | this->UI = new ApbUartPluginUi(); | |
29 | this->setWidget((QWidget*)this->UI); |
|
29 | this->setWidget((QWidget*)this->UI); | |
30 | this->useLoopBack = false; |
|
30 | this->useLoopBack = false; | |
31 | connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int))); |
|
31 | connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int))); | |
32 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString))); |
|
32 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString))); | |
33 | connect(&this->loopBackTimer,SIGNAL(timeout()),this,SLOT(uartReadout())); |
|
33 | connect(&this->loopBackTimer,SIGNAL(timeout()),this,SLOT(uartReadout())); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | ApbUartPlugin::~ApbUartPlugin() |
|
37 | ApbUartPlugin::~ApbUartPlugin() | |
38 | { |
|
38 | { | |
39 |
|
39 | |||
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void ApbUartPlugin::closeMe() |
|
42 | void ApbUartPlugin::closeMe() | |
43 | { |
|
43 | { | |
44 | emit this->closePlugin(this); |
|
44 | emit this->closePlugin(this); | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | void ApbUartPlugin::postInstantiationTrigger() |
|
47 | void ApbUartPlugin::postInstantiationTrigger() | |
48 | { |
|
48 | { | |
49 | if(this->isEnabled()) |
|
49 | if(this->isEnabled()) | |
50 | { |
|
50 | { | |
51 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
51 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
52 | loopbackChangeState(Qt::Checked); |
|
52 | loopbackChangeState(Qt::Checked); | |
53 | } |
|
53 | } | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | void ApbUartPlugin::loopbackChangeState(int state) |
|
56 | void ApbUartPlugin::loopbackChangeState(int state) | |
57 | { |
|
57 | { | |
58 | if(state==Qt::Checked) |
|
58 | if(state==Qt::Checked) | |
59 | { |
|
59 | { | |
60 | enableLoopback(); |
|
60 | enableLoopback(); | |
61 | } |
|
61 | } | |
62 | else |
|
62 | else | |
63 | { |
|
63 | { | |
64 | disableLoopback(); |
|
64 | disableLoopback(); | |
65 | } |
|
65 | } | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | void ApbUartPlugin::uartReadout() |
|
68 | void ApbUartPlugin::uartReadout() | |
69 | { |
|
69 | { | |
70 | #ifdef WIN32 |
|
70 | #ifdef WIN32 | |
71 | int readcnt=0; |
|
71 | int readcnt=0; | |
72 | #endif |
|
72 | #endif | |
73 | if(this->isEnabled() && parent!=NULL) |
|
73 | if(this->isEnabled() && parent!=NULL) | |
74 | { |
|
74 | { | |
75 | if(this->useLoopBack) |
|
75 | if(this->useLoopBack) | |
76 | { |
|
76 | { | |
77 | if(this->baseAddress()!=-1) |
|
77 | if(this->baseAddress()!=-1) | |
78 | { |
|
78 | { | |
79 | this->loopBackTimer.stop(); |
|
79 | this->loopBackTimer.stop(); | |
80 | unsigned int status_reg,data; |
|
80 | unsigned int status_reg,data; | |
81 | char ch; |
|
81 | char ch; | |
82 | QString printdata=""; |
|
82 | QString printdata=""; | |
83 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); |
|
83 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); | |
84 | while ((status_reg&4)==0) { |
|
84 | while ((status_reg&4)==0) { | |
85 | parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG); |
|
85 | parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG); | |
86 | ch = (char)(0xff & data); |
|
86 | ch = (char)(0xff & data); | |
87 | printdata+=ch; |
|
87 | printdata+=ch; | |
88 | #ifdef WIN32 |
|
88 | #ifdef WIN32 | |
89 | readcnt++; |
|
89 | readcnt++; | |
90 | if(readcnt>=32) |
|
90 | if(readcnt>=32) | |
91 | { |
|
91 | { | |
92 | qApp->processEvents(); |
|
92 | qApp->processEvents(); | |
93 | break; |
|
93 | break; | |
94 | } |
|
94 | } | |
95 | #endif |
|
95 | #endif | |
96 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); |
|
96 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); | |
97 | } |
|
97 | } | |
98 | if(printdata!="") |
|
98 | if(printdata!="") | |
99 | emit apbUartTextReceived(printdata); |
|
99 | emit apbUartTextReceived(printdata); | |
100 | this->loopBackTimer.start(200); |
|
100 | this->loopBackTimer.start(200); | |
101 | } |
|
101 | } | |
102 | else |
|
102 | else | |
103 | { |
|
103 | { | |
104 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
104 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
105 | this->enableLoopback(); |
|
105 | this->enableLoopback(); | |
106 | } |
|
106 | } | |
107 | } |
|
107 | } | |
108 | } |
|
108 | } | |
109 | } |
|
109 | } | |
110 |
|
110 | |||
111 | void ApbUartPlugin::activate(bool flag) |
|
111 | void ApbUartPlugin::activate(bool flag) | |
112 | { |
|
112 | { | |
113 | this->setEnabled(flag); |
|
113 | this->setEnabled(flag); | |
114 | emit this->activateSig(flag); |
|
114 | emit this->activateSig(flag); | |
115 | if(this->isEnabled()) |
|
115 | if(this->isEnabled()) | |
116 | {this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
116 | {this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
117 |
|
117 | |||
118 | loopbackChangeState(Qt::Checked); |
|
118 | loopbackChangeState(Qt::Checked); | |
119 | } |
|
119 | } | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | void ApbUartPlugin::activateScan(bool flag) |
|
122 | void ApbUartPlugin::activateScan(bool flag) | |
123 | { |
|
123 | { | |
124 | if(flag) |
|
124 | if(flag) | |
125 | this->loopBackTimer.start(200); |
|
125 | this->loopBackTimer.start(200); | |
126 | else |
|
126 | else | |
127 | this->loopBackTimer.stop(); |
|
127 | this->loopBackTimer.stop(); | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
130 | int ApbUartPlugin::enableLoopback() |
|
130 | int ApbUartPlugin::enableLoopback() | |
131 | { |
|
131 | { | |
132 |
|
132 | |||
133 | this->useLoopBack = true; |
|
133 | this->useLoopBack = true; | |
134 | this->loopBackTimer.start(200); |
|
134 | this->loopBackTimer.start(200); | |
135 | SocExplorerEngine::message(this,"Set FiFo debug mode mode"); |
|
135 | SocExplorerEngine::message(this,"Set FiFo debug mode mode"); | |
136 | if(parent==NULL) |
|
136 | if(parent==NULL) | |
137 | { |
|
137 | { | |
138 | SocExplorerEngine::message(this,"Can't set FiFo debug mode no parent driver accessible"); |
|
138 | SocExplorerEngine::message(this,"Can't set FiFo debug mode no parent driver accessible"); | |
139 | return -1; |
|
139 | return -1; | |
140 | } |
|
140 | } | |
141 | if(this->baseAddress()==-1) |
|
141 | if(this->baseAddress()==-1) | |
142 | { |
|
142 | { | |
143 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
143 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
144 | if(this->baseAddress()==-1) |
|
144 | if(this->baseAddress()==-1) | |
145 | return -1; |
|
145 | return -1; | |
146 | } |
|
146 | } | |
147 | unsigned int ctrl_reg= 0x843; |
|
147 | unsigned int ctrl_reg= 0x843; | |
148 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); |
|
148 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); | |
149 | return 0; |
|
149 | return 0; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int ApbUartPlugin::disableLoopback() |
|
152 | int ApbUartPlugin::disableLoopback() | |
153 | { |
|
153 | { | |
154 | SocExplorerEngine::message(this,"Disable FiFo debug mode mode"); |
|
154 | SocExplorerEngine::message(this,"Disable FiFo debug mode mode"); | |
155 | if(parent==NULL) |
|
155 | if(parent==NULL) | |
156 | { |
|
156 | { | |
157 | SocExplorerEngine::message(this,"Can't disable FiFo debug mode no parent driver accessible"); |
|
157 | SocExplorerEngine::message(this,"Can't disable FiFo debug mode no parent driver accessible"); | |
158 | return -1; |
|
158 | return -1; | |
159 | } |
|
159 | } | |
160 | if(this->baseAddress()==-1) |
|
160 | if(this->baseAddress()==-1) | |
161 | { |
|
161 | { | |
162 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); |
|
162 | this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0)); | |
163 | if(this->baseAddress()==-1) |
|
163 | if(this->baseAddress()==-1) | |
164 | return -1; |
|
164 | return -1; | |
165 | } |
|
165 | } | |
166 | unsigned int ctrl_reg; |
|
166 | unsigned int ctrl_reg; | |
167 | this->loopBackTimer.stop(); |
|
167 | this->loopBackTimer.stop(); | |
168 | /* Firts get Control reg value*/ |
|
168 | /* Firts get Control reg value*/ | |
169 | parent->Read(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); |
|
169 | parent->Read(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); | |
170 | ctrl_reg = ctrl_reg & (~(1<<11)); |
|
170 | ctrl_reg = ctrl_reg & (~(1<<11)); | |
171 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); |
|
171 | parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); | |
172 | this->useLoopBack = false; |
|
172 | this->useLoopBack = false; | |
173 | return 0; |
|
173 | return 0; | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
176 |
|
176 | |||
177 | unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
177 | unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
178 | { |
|
178 | { | |
179 | if(parent!=NULL) |
|
179 | if(parent!=NULL) | |
180 | return parent->Read(Value,count,address); |
|
180 | return parent->Read(Value,count,address); | |
181 | return 0; |
|
181 | return 0; | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address) |
|
185 | unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address) | |
186 | { |
|
186 | { | |
187 | if(parent!=NULL) |
|
187 | if(parent!=NULL) | |
188 | return parent->Write(Value,count,address); |
|
188 | return parent->Write(Value,count,address); | |
189 | return 0; |
|
189 | return 0; | |
190 | } |
|
190 | } | |
191 |
|
191 | |||
192 |
|
192 | |||
193 |
|
193 | |||
194 |
|
194 | |||
195 |
|
195 | |||
196 |
|
196 | |||
197 |
|
197 | |||
198 |
|
198 |
@@ -1,69 +1,69 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBUARTPLUGIN_H |
|
22 | #ifndef APBUARTPLUGIN_H | |
23 | #define APBUARTPLUGIN_H |
|
23 | #define APBUARTPLUGIN_H | |
24 | #include <QMenuBar> |
|
24 | #include <QMenuBar> | |
25 | #include <QMenu> |
|
25 | #include <QMenu> | |
26 | #include <QAction> |
|
26 | #include <QAction> | |
27 | #include <QLayout> |
|
27 | #include <QLayout> | |
28 |
|
28 | |||
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 | #include <apbuartpluginui.h> |
|
30 | #include <apbuartpluginui.h> | |
31 | #include <QTimer> |
|
31 | #include <QTimer> | |
32 |
|
32 | |||
33 | #define APB_UART_DATA_REG 0x0 |
|
33 | #define APB_UART_DATA_REG 0x0 | |
34 | #define APB_UART_STATUS_REG 0x4 |
|
34 | #define APB_UART_STATUS_REG 0x4 | |
35 | #define APB_UART_CONTROL_REG 0x8 |
|
35 | #define APB_UART_CONTROL_REG 0x8 | |
36 | #define APB_UART_SCALE_REG 0xC |
|
36 | #define APB_UART_SCALE_REG 0xC | |
37 | #define APB_UART_FIFO_DEBUG_REG 0x10 |
|
37 | #define APB_UART_FIFO_DEBUG_REG 0x10 | |
38 |
|
38 | |||
39 |
|
39 | |||
40 | class ApbUartPlugin : public socexplorerplugin |
|
40 | class ApbUartPlugin : public socexplorerplugin | |
41 | { |
|
41 | { | |
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 | public: |
|
43 | public: | |
44 | explicit ApbUartPlugin(QWidget *parent = 0); |
|
44 | explicit ApbUartPlugin(QWidget *parent = 0); | |
45 | ~ApbUartPlugin(); |
|
45 | ~ApbUartPlugin(); | |
46 | int VID(){return driver_VID;} |
|
46 | int VID(){return driver_VID;} | |
47 | int PID(){return driver_PID;} |
|
47 | int PID(){return driver_PID;} | |
48 |
|
48 | |||
49 | public slots: |
|
49 | public slots: | |
50 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
50 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); | |
51 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
51 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
52 | void closeMe(); |
|
52 | void closeMe(); | |
53 | void postInstantiationTrigger(); |
|
53 | void postInstantiationTrigger(); | |
54 | void loopbackChangeState( int state ); |
|
54 | void loopbackChangeState( int state ); | |
55 | void uartReadout(); |
|
55 | void uartReadout(); | |
56 | void activateScan(bool flag); |
|
56 | void activateScan(bool flag); | |
57 | void activate(bool flag); |
|
57 | void activate(bool flag); | |
58 | signals: |
|
58 | signals: | |
59 | void apbUartTextReceived(QString text); |
|
59 | void apbUartTextReceived(QString text); | |
60 | private: |
|
60 | private: | |
61 | ApbUartPluginUi* UI; |
|
61 | ApbUartPluginUi* UI; | |
62 | bool useLoopBack; |
|
62 | bool useLoopBack; | |
63 | QTimer loopBackTimer; |
|
63 | QTimer loopBackTimer; | |
64 | int enableLoopback(); |
|
64 | int enableLoopback(); | |
65 | int disableLoopback(); |
|
65 | int disableLoopback(); | |
66 | }; |
|
66 | }; | |
67 |
|
67 | |||
68 | #endif // APBUARTPLUGIN_H |
|
68 | #endif // APBUARTPLUGIN_H | |
69 |
|
69 |
@@ -1,33 +1,33 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "apbuartcfg.h" |
|
22 | #include "apbuartcfg.h" | |
23 |
|
23 | |||
24 | ApbUartCfg::ApbUartCfg(QWidget *parent) : |
|
24 | ApbUartCfg::ApbUartCfg(QWidget *parent) : | |
25 | QWidget(parent) |
|
25 | QWidget(parent) | |
26 | { |
|
26 | { | |
27 | this->mainLayout = new QGridLayout(this); |
|
27 | this->mainLayout = new QGridLayout(this); | |
28 | this->loopbackChkBx = new QCheckBox(tr("Enable loopback"),this); |
|
28 | this->loopbackChkBx = new QCheckBox(tr("Enable loopback"),this); | |
29 | this->loopbackChkBx->setChecked(true); |
|
29 | this->loopbackChkBx->setChecked(true); | |
30 | this->mainLayout->addWidget(this->loopbackChkBx); |
|
30 | this->mainLayout->addWidget(this->loopbackChkBx); | |
31 | this->setLayout(this->mainLayout); |
|
31 | this->setLayout(this->mainLayout); | |
32 | connect(this->loopbackChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); |
|
32 | connect(this->loopbackChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); | |
33 | } |
|
33 | } |
@@ -1,46 +1,46 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBUARTCFG_H |
|
22 | #ifndef APBUARTCFG_H | |
23 | #define APBUARTCFG_H |
|
23 | #define APBUARTCFG_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QCheckBox> |
|
26 | #include <QCheckBox> | |
27 | #include <QLabel> |
|
27 | #include <QLabel> | |
28 | #include <QGridLayout> |
|
28 | #include <QGridLayout> | |
29 |
|
29 | |||
30 | class ApbUartCfg : public QWidget |
|
30 | class ApbUartCfg : public QWidget | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | public: |
|
33 | public: | |
34 | explicit ApbUartCfg(QWidget *parent = 0); |
|
34 | explicit ApbUartCfg(QWidget *parent = 0); | |
35 |
|
35 | |||
36 | signals: |
|
36 | signals: | |
37 | void loopbackChkBxStateChanged( int state ); |
|
37 | void loopbackChkBxStateChanged( int state ); | |
38 | public slots: |
|
38 | public slots: | |
39 |
|
39 | |||
40 | private: |
|
40 | private: | |
41 | QCheckBox* loopbackChkBx; |
|
41 | QCheckBox* loopbackChkBx; | |
42 | QGridLayout* mainLayout; |
|
42 | QGridLayout* mainLayout; | |
43 |
|
43 | |||
44 | }; |
|
44 | }; | |
45 |
|
45 | |||
46 | #endif // APBUARTCFG_H |
|
46 | #endif // APBUARTCFG_H |
@@ -1,34 +1,34 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "apbuartpluginui.h" |
|
22 | #include "apbuartpluginui.h" | |
23 |
|
23 | |||
24 | ApbUartPluginUi::ApbUartPluginUi(QWidget *parent) : |
|
24 | ApbUartPluginUi::ApbUartPluginUi(QWidget *parent) : | |
25 | QTabWidget(parent) |
|
25 | QTabWidget(parent) | |
26 | { |
|
26 | { | |
27 | this->terminal = new ApbUartTerminal(this); |
|
27 | this->terminal = new ApbUartTerminal(this); | |
28 | this->cfg = new ApbUartCfg(this); |
|
28 | this->cfg = new ApbUartCfg(this); | |
29 |
|
29 | |||
30 | this->addTab(this->cfg,"Config"); |
|
30 | this->addTab(this->cfg,"Config"); | |
31 | this->addTab(this->terminal,"terminal"); |
|
31 | this->addTab(this->terminal,"terminal"); | |
32 | connect(this->cfg,SIGNAL(loopbackChkBxStateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); |
|
32 | connect(this->cfg,SIGNAL(loopbackChkBxStateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); | |
33 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->terminal,SIGNAL(apbUartTextReceived(QString))); |
|
33 | connect(this,SIGNAL(apbUartTextReceived(QString)),this->terminal,SIGNAL(apbUartTextReceived(QString))); | |
34 | } |
|
34 | } |
@@ -1,51 +1,51 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBUARTPLUGINUI_H |
|
22 | #ifndef APBUARTPLUGINUI_H | |
23 | #define APBUARTPLUGINUI_H |
|
23 | #define APBUARTPLUGINUI_H | |
24 |
|
24 | |||
25 | #include "apbuartcfg.h" |
|
25 | #include "apbuartcfg.h" | |
26 | #include <QWidget> |
|
26 | #include <QWidget> | |
27 | #include <QGridLayout> |
|
27 | #include <QGridLayout> | |
28 | #include <QTabWidget> |
|
28 | #include <QTabWidget> | |
29 | #include <QCheckBox> |
|
29 | #include <QCheckBox> | |
30 | #include <QLabel> |
|
30 | #include <QLabel> | |
31 | #include <QLineEdit> |
|
31 | #include <QLineEdit> | |
32 | #include <QTextEdit> |
|
32 | #include <QTextEdit> | |
33 | #include "apbuartterminal.h" |
|
33 | #include "apbuartterminal.h" | |
34 |
|
34 | |||
35 | class ApbUartPluginUi : public QTabWidget |
|
35 | class ApbUartPluginUi : public QTabWidget | |
36 | { |
|
36 | { | |
37 | Q_OBJECT |
|
37 | Q_OBJECT | |
38 | public: |
|
38 | public: | |
39 | explicit ApbUartPluginUi(QWidget *parent = 0); |
|
39 | explicit ApbUartPluginUi(QWidget *parent = 0); | |
40 |
|
40 | |||
41 | signals: |
|
41 | signals: | |
42 | void loopbackChkBxStateChanged( int state ); |
|
42 | void loopbackChkBxStateChanged( int state ); | |
43 | void apbUartTextReceived(QString text); |
|
43 | void apbUartTextReceived(QString text); | |
44 | public slots: |
|
44 | public slots: | |
45 |
|
45 | |||
46 | private: |
|
46 | private: | |
47 | ApbUartCfg* cfg; |
|
47 | ApbUartCfg* cfg; | |
48 | ApbUartTerminal* terminal; |
|
48 | ApbUartTerminal* terminal; | |
49 | }; |
|
49 | }; | |
50 |
|
50 | |||
51 | #endif // APBUARTPLUGINUI_H |
|
51 | #endif // APBUARTPLUGINUI_H |
@@ -1,28 +1,28 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "apbuartterminal.h" |
|
22 | #include "apbuartterminal.h" | |
23 |
|
23 | |||
24 | ApbUartTerminal::ApbUartTerminal(QWidget *parent) : |
|
24 | ApbUartTerminal::ApbUartTerminal(QWidget *parent) : | |
25 | QTextEdit(parent) |
|
25 | QTextEdit(parent) | |
26 | { |
|
26 | { | |
27 | connect(this,SIGNAL(apbUartTextReceived(QString)),this,SLOT(append(QString))); |
|
27 | connect(this,SIGNAL(apbUartTextReceived(QString)),this,SLOT(append(QString))); | |
28 | } |
|
28 | } |
@@ -1,41 +1,41 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBUARTTERMINAL_H |
|
22 | #ifndef APBUARTTERMINAL_H | |
23 | #define APBUARTTERMINAL_H |
|
23 | #define APBUARTTERMINAL_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QTextEdit> |
|
26 | #include <QTextEdit> | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | class ApbUartTerminal : public QTextEdit |
|
29 | class ApbUartTerminal : public QTextEdit | |
30 | { |
|
30 | { | |
31 | Q_OBJECT |
|
31 | Q_OBJECT | |
32 | public: |
|
32 | public: | |
33 | explicit ApbUartTerminal(QWidget *parent = 0); |
|
33 | explicit ApbUartTerminal(QWidget *parent = 0); | |
34 |
|
34 | |||
35 | signals: |
|
35 | signals: | |
36 | void apbUartTextReceived(QString text); |
|
36 | void apbUartTextReceived(QString text); | |
37 | public slots: |
|
37 | public slots: | |
38 |
|
38 | |||
39 | }; |
|
39 | }; | |
40 |
|
40 | |||
41 | #endif // APBUARTTERMINAL_H |
|
41 | #endif // APBUARTTERMINAL_H |
@@ -1,467 +1,467 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include <socexplorerengine.h> |
|
22 | #include <socexplorerengine.h> | |
23 | #include "ahbuartplugin.h" |
|
23 | #include "ahbuartplugin.h" | |
24 | #include <unistd.h> |
|
24 | #include <unistd.h> | |
25 | #include <errno.h> |
|
25 | #include <errno.h> | |
26 | #include <QApplication> |
|
26 | #include <QApplication> | |
27 | #include <QProgressBar> |
|
27 | #include <QProgressBar> | |
28 | #include <stdio.h> |
|
28 | #include <stdio.h> | |
29 | #include <QThread> |
|
29 | #include <QThread> | |
30 | #include "ahbuartpywrapper.h" |
|
30 | #include "ahbuartpywrapper.h" | |
31 | #include <QCompleter> |
|
31 | #include <QCompleter> | |
32 | #include <QStringList> |
|
32 | #include <QStringList> | |
33 | #include <QLineEdit> |
|
33 | #include <QLineEdit> | |
34 | #include <socexplorerproxy.h> |
|
34 | #include <socexplorerproxy.h> | |
35 |
|
35 | |||
36 | ahbuartplugin::ahbuartplugin(QWidget *parent):socexplorerplugin(parent,false) |
|
36 | ahbuartplugin::ahbuartplugin(QWidget *parent):socexplorerplugin(parent,false) | |
37 | { |
|
37 | { | |
38 | this->port =(rs232port_t)NULL; |
|
38 | this->port =(rs232port_t)NULL; | |
39 | this->portMutex = new QMutex(QMutex::Recursive); |
|
39 | this->portMutex = new QMutex(QMutex::Recursive); | |
40 | this->UI = new ahbUartPluginUI(); |
|
40 | this->UI = new ahbUartPluginUI(); | |
41 | this->setWidget((QWidget*)this->UI); |
|
41 | this->setWidget((QWidget*)this->UI); | |
42 | QObject::connect(this,SIGNAL(activateSig(bool)),this->UI,SLOT(setConnected(bool))); |
|
42 | QObject::connect(this,SIGNAL(activateSig(bool)),this->UI,SLOT(setConnected(bool))); | |
43 | QObject::connect(this->UI,SIGNAL(connectPortsig(QString,int)),this,SLOT(togglePort(QString,int))); |
|
43 | QObject::connect(this->UI,SIGNAL(connectPortsig(QString,int)),this,SLOT(togglePort(QString,int))); | |
44 | this->pyObject = new ahbuartPywrapper(this); |
|
44 | this->pyObject = new ahbuartPywrapper(this); | |
45 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(open(QString,int)),this,SLOT(open(QString,int))); |
|
45 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(open(QString,int)),this,SLOT(open(QString,int))); | |
46 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(close()),this,SLOT(close())); |
|
46 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(close()),this,SLOT(close())); | |
47 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(ReadBytes(uint,uint)),this,SLOT(ReadBytes(uint,uint))); |
|
47 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(ReadBytes(uint,uint)),this,SLOT(ReadBytes(uint,uint))); | |
48 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(WriteBytes(uint,QList<QVariant>)),this,SLOT(WriteBytes(uint,QList<QVariant>))); |
|
48 | QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(WriteBytes(uint,QList<QVariant>)),this,SLOT(WriteBytes(uint,QList<QVariant>))); | |
49 | QObject::connect(this->UI,SIGNAL(rescanPorts()),this,SLOT(updatePortList())); |
|
49 | QObject::connect(this->UI,SIGNAL(rescanPorts()),this,SLOT(updatePortList())); | |
50 | this->portListcompleter = NULL; |
|
50 | this->portListcompleter = NULL; | |
51 | this->scanDone = false; |
|
51 | this->scanDone = false; | |
52 | updatePortList(); |
|
52 | updatePortList(); | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 |
|
55 | |||
56 | ahbuartplugin::~ahbuartplugin() |
|
56 | ahbuartplugin::~ahbuartplugin() | |
57 | { |
|
57 | { | |
58 | if(this->port!=(rs232port_t)NULL) |
|
58 | if(this->port!=(rs232port_t)NULL) | |
59 | { |
|
59 | { | |
60 | rs232close(this->port); |
|
60 | rs232close(this->port); | |
61 | this->port = (rs232port_t)NULL; |
|
61 | this->port = (rs232port_t)NULL; | |
62 | } |
|
62 | } | |
63 | this->UI->close(); |
|
63 | this->UI->close(); | |
64 | this->UI->~ahbUartPluginUI(); |
|
64 | this->UI->~ahbUartPluginUI(); | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 |
|
67 | |||
68 | void ahbuartplugin::closeMe() |
|
68 | void ahbuartplugin::closeMe() | |
69 | { |
|
69 | { | |
70 | if(this->port!=(rs232port_t)NULL) |
|
70 | if(this->port!=(rs232port_t)NULL) | |
71 | { |
|
71 | { | |
72 | rs232close(this->port); |
|
72 | rs232close(this->port); | |
73 | this->port = (rs232port_t)NULL; |
|
73 | this->port = (rs232port_t)NULL; | |
74 | } |
|
74 | } | |
75 | emit this->closePlugin(this); |
|
75 | emit this->closePlugin(this); | |
76 | } |
|
76 | } | |
77 |
|
77 | |||
78 | int ahbuartplugin::registermenu(QMainWindow *menuHolder) |
|
78 | int ahbuartplugin::registermenu(QMainWindow *menuHolder) | |
79 | { |
|
79 | { | |
80 | this->menu = menuHolder->menuBar()->addMenu(tr("&AHB UART")); |
|
80 | this->menu = menuHolder->menuBar()->addMenu(tr("&AHB UART")); | |
81 | this->closeAction = this->menu->addAction(tr("Close plugin")); |
|
81 | this->closeAction = this->menu->addAction(tr("Close plugin")); | |
82 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); |
|
82 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); | |
83 | return 1; |
|
83 | return 1; | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 |
|
86 | |||
87 |
|
87 | |||
88 |
|
88 | |||
89 | bool ahbuartplugin::checkConnection() |
|
89 | bool ahbuartplugin::checkConnection() | |
90 | { |
|
90 | { | |
91 | QTime timeout; |
|
91 | QTime timeout; | |
92 | char test[5] ={(char)0x80,(char)0x80,(char)0,(char)0,(char)0}; |
|
92 | char test[5] ={(char)0x80,(char)0x80,(char)0,(char)0,(char)0}; | |
93 | char test2[1024]; |
|
93 | char test2[1024]; | |
94 | int writen =0; |
|
94 | int writen =0; | |
95 | int read = 0; |
|
95 | int read = 0; | |
96 | timeout.start(); |
|
96 | timeout.start(); | |
97 | SocExplorerEngine::message(this,"Check connection",2); |
|
97 | SocExplorerEngine::message(this,"Check connection",2); | |
98 | while(writen!=5) |
|
98 | while(writen!=5) | |
99 | { |
|
99 | { | |
100 | writen+=rs232write(this->port,test+writen,5-writen); |
|
100 | writen+=rs232write(this->port,test+writen,5-writen); | |
101 | if(timeout.elapsed()>1000) |
|
101 | if(timeout.elapsed()>1000) | |
102 | { |
|
102 | { | |
103 | SocExplorerEngine::message(this,"Can't write any data on serial port",2); |
|
103 | SocExplorerEngine::message(this,"Can't write any data on serial port",2); | |
104 | return false; |
|
104 | return false; | |
105 | } |
|
105 | } | |
106 | } |
|
106 | } | |
107 | #ifdef WIN32 |
|
107 | #ifdef WIN32 | |
108 | usleep(1000); |
|
108 | usleep(1000); | |
109 | #endif |
|
109 | #endif | |
110 | timeout.restart(); |
|
110 | timeout.restart(); | |
111 | while(read!=4) |
|
111 | while(read!=4) | |
112 | { |
|
112 | { | |
113 | read += rs232read(this->port,test2,4-read); |
|
113 | read += rs232read(this->port,test2,4-read); | |
114 | if(timeout.elapsed()>1000) break; |
|
114 | if(timeout.elapsed()>1000) break; | |
115 | } |
|
115 | } | |
116 | if(read>0) |
|
116 | if(read>0) | |
117 | { |
|
117 | { | |
118 | SocExplorerEngine::message(this,"Connection Ok",2); |
|
118 | SocExplorerEngine::message(this,"Connection Ok",2); | |
119 | return true; |
|
119 | return true; | |
120 | } |
|
120 | } | |
121 | else |
|
121 | else | |
122 | { |
|
122 | { | |
123 | SocExplorerEngine::message(this,"Connection Error",2); |
|
123 | SocExplorerEngine::message(this,"Connection Error",2); | |
124 | return false; |
|
124 | return false; | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | } |
|
127 | } | |
128 |
|
128 | |||
129 | void ahbuartplugin::connectPort(QString PortName, int baudrate) |
|
129 | void ahbuartplugin::connectPort(QString PortName, int baudrate) | |
130 | { |
|
130 | { | |
131 | QTime timeout; |
|
131 | QTime timeout; | |
132 | SocExplorerEngine::message(this,"Try to connect to port "+PortName,2); |
|
132 | SocExplorerEngine::message(this,"Try to connect to port "+PortName,2); | |
133 | timeout.start(); |
|
133 | timeout.start(); | |
134 | if(this->port==(rs232port_t)NULL) |
|
134 | if(this->port==(rs232port_t)NULL) | |
135 | { |
|
135 | { | |
136 | SocExplorerEngine::message(this,"Open port "+PortName,2); |
|
136 | SocExplorerEngine::message(this,"Open port "+PortName,2); | |
137 | this->port=rs232open((char*)PortName.toStdString().c_str()); |
|
137 | this->port=rs232open((char*)PortName.toStdString().c_str()); | |
138 | } |
|
138 | } | |
139 | if(this->port!=badPortValue) |
|
139 | if(this->port!=badPortValue) | |
140 | { |
|
140 | { | |
141 | SocExplorerEngine::message(this,"Port opened "+PortName,2); |
|
141 | SocExplorerEngine::message(this,"Port opened "+PortName,2); | |
142 | SocExplorerEngine::message(this,"Configure port "+PortName,2); |
|
142 | SocExplorerEngine::message(this,"Configure port "+PortName,2); | |
143 | rs232setup(this->port,8,baudrate,rs232parityNo,rs232OneStop); |
|
143 | rs232setup(this->port,8,baudrate,rs232parityNo,rs232OneStop); | |
144 | char test[7] ={(char)0x55,(char)0x51,(char)0x80,(char)0x80,(char)0x0,(char)0x0,(char)0x14}; |
|
144 | char test[7] ={(char)0x55,(char)0x51,(char)0x80,(char)0x80,(char)0x0,(char)0x0,(char)0x14}; | |
145 | char test2[1024]; |
|
145 | char test2[1024]; | |
146 | SAFEWRITE(test,1,timeout,2000,return); |
|
146 | SAFEWRITE(test,1,timeout,2000,return); | |
147 | SAFEWRITE((test+1),1,timeout,2000,return); |
|
147 | SAFEWRITE((test+1),1,timeout,2000,return); | |
148 | APPENDTOLOG(QString("Flush port ")); |
|
148 | APPENDTOLOG(QString("Flush port ")); | |
149 | rs232read(this->port,test2,512); |
|
149 | rs232read(this->port,test2,512); | |
150 | int read = 0; |
|
150 | int read = 0; | |
151 | for(int i=0;i<10;i++) |
|
151 | for(int i=0;i<10;i++) | |
152 | { |
|
152 | { | |
153 | SocExplorerEngine::message(this,"Send test patern :0x55,0x55,0x80,0x80,0x0,0x0,0x14",2); |
|
153 | SocExplorerEngine::message(this,"Send test patern :0x55,0x55,0x80,0x80,0x0,0x0,0x14",2); | |
154 | SAFEWRITE(test+2,5,timeout,2000,return); |
|
154 | SAFEWRITE(test+2,5,timeout,2000,return); | |
155 | SocExplorerEngine::message(this,"Read Result",2); |
|
155 | SocExplorerEngine::message(this,"Read Result",2); | |
156 | read=rs232read(this->port,test2+read,16); |
|
156 | read=rs232read(this->port,test2+read,16); | |
157 | SocExplorerEngine::message(this,QString("Get ") + QString::number(read) + " bytes",2); |
|
157 | SocExplorerEngine::message(this,QString("Get ") + QString::number(read) + " bytes",2); | |
158 | if(read>0) |
|
158 | if(read>0) | |
159 | { |
|
159 | { | |
160 | SocExplorerEngine::message(this,"Flush port ",2); |
|
160 | SocExplorerEngine::message(this,"Flush port ",2); | |
161 | while(rs232read(this->port,test2,1)>0); |
|
161 | while(rs232read(this->port,test2,1)>0); | |
162 | this->Connected = true; |
|
162 | this->Connected = true; | |
163 | SocExplorerEngine::message(this,QString("Connection success on ")+PortName,2); |
|
163 | SocExplorerEngine::message(this,QString("Connection success on ")+PortName,2); | |
164 | emit this->activate(true); |
|
164 | emit this->activate(true); | |
165 | if(this->scanDone==false) |
|
165 | if(this->scanDone==false) | |
166 | { |
|
166 | { | |
167 | socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN"); |
|
167 | socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN"); | |
168 | this->scanDone=true; |
|
168 | this->scanDone=true; | |
169 | } |
|
169 | } | |
170 | break; |
|
170 | break; | |
171 | } |
|
171 | } | |
172 | } |
|
172 | } | |
173 | } |
|
173 | } | |
174 | else |
|
174 | else | |
175 | { |
|
175 | { | |
176 | SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2); |
|
176 | SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2); | |
177 | this->port = (rs232port_t)NULL; |
|
177 | this->port = (rs232port_t)NULL; | |
178 | this->Connected = false; |
|
178 | this->Connected = false; | |
179 | emit this->activateSig(false); |
|
179 | emit this->activateSig(false); | |
180 | return; |
|
180 | return; | |
181 | } |
|
181 | } | |
182 | if(this->Connected == false) |
|
182 | if(this->Connected == false) | |
183 | { |
|
183 | { | |
184 | SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2); |
|
184 | SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2); | |
185 | rs232close(this->port); |
|
185 | rs232close(this->port); | |
186 | this->port = (rs232port_t)NULL; |
|
186 | this->port = (rs232port_t)NULL; | |
187 | emit this->activateSig(false); |
|
187 | emit this->activateSig(false); | |
188 | } |
|
188 | } | |
189 |
|
189 | |||
190 | } |
|
190 | } | |
191 |
|
191 | |||
192 | bool ahbuartplugin::open(QString PortName,int baudrate) |
|
192 | bool ahbuartplugin::open(QString PortName,int baudrate) | |
193 | { |
|
193 | { | |
194 | if(this->port!=(rs232port_t)NULL) |
|
194 | if(this->port!=(rs232port_t)NULL) | |
195 | this->close(); |
|
195 | this->close(); | |
196 | this->UI->setconfig(PortName,baudrate); |
|
196 | this->UI->setconfig(PortName,baudrate); | |
197 | this->connectPort(PortName,baudrate); |
|
197 | this->connectPort(PortName,baudrate); | |
198 | return (this->port!=(rs232port_t)NULL); |
|
198 | return (this->port!=(rs232port_t)NULL); | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | void ahbuartplugin::close() |
|
201 | void ahbuartplugin::close() | |
202 | { |
|
202 | { | |
203 | if(this->port!=(rs232port_t)NULL) |
|
203 | if(this->port!=(rs232port_t)NULL) | |
204 | { |
|
204 | { | |
205 | rs232close(this->port); |
|
205 | rs232close(this->port); | |
206 | this->port = (rs232port_t)NULL; |
|
206 | this->port = (rs232port_t)NULL; | |
207 | this->Connected = false; |
|
207 | this->Connected = false; | |
208 | emit this->activateSig(false); |
|
208 | emit this->activateSig(false); | |
209 | } |
|
209 | } | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 | void ahbuartplugin::togglePort(QString PortName,int baudrate) |
|
212 | void ahbuartplugin::togglePort(QString PortName,int baudrate) | |
213 | { |
|
213 | { | |
214 | if(this->port!=(rs232port_t)NULL) |
|
214 | if(this->port!=(rs232port_t)NULL) | |
215 | { |
|
215 | { | |
216 | this->close(); |
|
216 | this->close(); | |
217 | } |
|
217 | } | |
218 | else |
|
218 | else | |
219 | { |
|
219 | { | |
220 | this->connectPort(PortName,baudrate); |
|
220 | this->connectPort(PortName,baudrate); | |
221 | } |
|
221 | } | |
222 | } |
|
222 | } | |
223 |
|
223 | |||
224 |
|
224 | |||
225 | unsigned int ahbuartplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
225 | unsigned int ahbuartplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
226 | { |
|
226 | { | |
227 | QTime timeout; |
|
227 | QTime timeout; | |
228 | timeout.start(); |
|
228 | timeout.start(); | |
229 | unsigned int read=0; |
|
229 | unsigned int read=0; | |
230 | unsigned int cnt=count; |
|
230 | unsigned int cnt=count; | |
231 | unsigned int nextUpdateTrig=0,updateStep=512; |
|
231 | unsigned int nextUpdateTrig=0,updateStep=512; | |
232 | SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2); |
|
232 | SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2); | |
233 | if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL)) |
|
233 | if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL)) | |
234 | { |
|
234 | { | |
235 | if(!this->portMutex->tryLock()) |
|
235 | if(!this->portMutex->tryLock()) | |
236 | return 0; |
|
236 | return 0; | |
237 | if(!this->checkConnection()) |
|
237 | if(!this->checkConnection()) | |
238 | { |
|
238 | { | |
239 | this->Connected = false; |
|
239 | this->Connected = false; | |
240 | emit this->activateSig(false); |
|
240 | emit this->activateSig(false); | |
241 | this->portMutex->unlock(); |
|
241 | this->portMutex->unlock(); | |
242 | return 0; |
|
242 | return 0; | |
243 | } |
|
243 | } | |
244 | QProgressBar* progress=NULL; |
|
244 | QProgressBar* progress=NULL; | |
245 | if(cnt>128) |
|
245 | if(cnt>128) | |
246 | progress= SocExplorerEngine::getProgressBar("Reading on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); |
|
246 | progress= SocExplorerEngine::getProgressBar("Reading on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); | |
247 | char CMD[5]; |
|
247 | char CMD[5]; | |
248 | char* result = (char*)malloc(count*4); |
|
248 | char* result = (char*)malloc(count*4); | |
249 | while(count>32) |
|
249 | while(count>32) | |
250 | { |
|
250 | { | |
251 | CMD[0] = 0x80 | (32-1); |
|
251 | CMD[0] = 0x80 | (32-1); | |
252 | CMD[1] = (char)((address>>24)&0xFF); |
|
252 | CMD[1] = (char)((address>>24)&0xFF); | |
253 | CMD[2] = (char)((address>>16)&0xFF); |
|
253 | CMD[2] = (char)((address>>16)&0xFF); | |
254 | CMD[3] = (char)((address>>8)&0xFF); |
|
254 | CMD[3] = (char)((address>>8)&0xFF); | |
255 | CMD[4] = (char)((address)&0xFF); |
|
255 | CMD[4] = (char)((address)&0xFF); | |
256 | // APENDTABLETOLOG(CMD,5,logmessage,"Write CMD : "); |
|
256 | // APENDTABLETOLOG(CMD,5,logmessage,"Write CMD : "); | |
257 | SAFEWRITE(CMD,5,timeout,1000,return 0); |
|
257 | SAFEWRITE(CMD,5,timeout,1000,return 0); | |
258 | #ifdef WIN32 |
|
258 | #ifdef WIN32 | |
259 | usleep(1000); |
|
259 | usleep(1000); | |
260 | #endif |
|
260 | #endif | |
261 | SAFEREAD(result+((cnt-count)*4),32*4,timeout,1000,return 0); |
|
261 | SAFEREAD(result+((cnt-count)*4),32*4,timeout,1000,return 0); | |
262 | // APENDTABLETOLOG((result+((cnt-count)*4)),32*4,logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); |
|
262 | // APENDTABLETOLOG((result+((cnt-count)*4)),32*4,logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); | |
263 | count-=32; |
|
263 | count-=32; | |
264 | address+=32*4; |
|
264 | address+=32*4; | |
265 | if(cnt>128) |
|
265 | if(cnt>128) | |
266 | { |
|
266 | { | |
267 |
|
267 | |||
268 | if((cnt-count)>=nextUpdateTrig) |
|
268 | if((cnt-count)>=nextUpdateTrig) | |
269 | { |
|
269 | { | |
270 | progress->setValue(cnt-count); |
|
270 | progress->setValue(cnt-count); | |
271 | qApp->processEvents(); |
|
271 | qApp->processEvents(); | |
272 | nextUpdateTrig+=updateStep; |
|
272 | nextUpdateTrig+=updateStep; | |
273 | } |
|
273 | } | |
274 | } |
|
274 | } | |
275 | } |
|
275 | } | |
276 | if(count>0) |
|
276 | if(count>0) | |
277 | { |
|
277 | { | |
278 | CMD[0] = 0x80 | (count-1); |
|
278 | CMD[0] = 0x80 | (count-1); | |
279 | CMD[1] = (char)((address>>24)&0xFF); |
|
279 | CMD[1] = (char)((address>>24)&0xFF); | |
280 | CMD[2] = (char)((address>>16)&0xFF); |
|
280 | CMD[2] = (char)((address>>16)&0xFF); | |
281 | CMD[3] = (char)((address>>8)&0xFF); |
|
281 | CMD[3] = (char)((address>>8)&0xFF); | |
282 | CMD[4] = (char)((address)&0xFF); |
|
282 | CMD[4] = (char)((address)&0xFF); | |
283 | SAFEWRITE(CMD,5,timeout,1000,return 0); |
|
283 | SAFEWRITE(CMD,5,timeout,1000,return 0); | |
284 | #ifdef WIN32 |
|
284 | #ifdef WIN32 | |
285 | usleep(1000); |
|
285 | usleep(1000); | |
286 | #endif |
|
286 | #endif | |
287 | SAFEREAD(result+((cnt-count)*4),(count*4),timeout,1000,return 0); |
|
287 | SAFEREAD(result+((cnt-count)*4),(count*4),timeout,1000,return 0); | |
288 | // APENDTABLETOLOG((result+((cnt-count)*4)),(count*4),logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); |
|
288 | // APENDTABLETOLOG((result+((cnt-count)*4)),(count*4),logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); | |
289 | } |
|
289 | } | |
290 | if(cnt>128) |
|
290 | if(cnt>128) | |
291 | { |
|
291 | { | |
292 | progress->setValue(cnt-count); |
|
292 | progress->setValue(cnt-count); | |
293 | qApp->processEvents(); |
|
293 | qApp->processEvents(); | |
294 | } |
|
294 | } | |
295 | for(int i=0;(unsigned int)i<cnt;i++) |
|
295 | for(int i=0;(unsigned int)i<cnt;i++) | |
296 | { |
|
296 | { | |
297 | for(int j =0;j<4;j++) |
|
297 | for(int j =0;j<4;j++) | |
298 | { |
|
298 | { | |
299 | Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256; |
|
299 | Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256; | |
300 | } |
|
300 | } | |
301 | read = cnt*4; |
|
301 | read = cnt*4; | |
302 |
|
302 | |||
303 | } |
|
303 | } | |
304 | if(cnt>128) |
|
304 | if(cnt>128) | |
305 | SocExplorerEngine::deleteProgressBar(progress); |
|
305 | SocExplorerEngine::deleteProgressBar(progress); | |
306 | free(result); |
|
306 | free(result); | |
307 | this->portMutex->unlock(); |
|
307 | this->portMutex->unlock(); | |
308 | } |
|
308 | } | |
309 | return read/4; |
|
309 | return read/4; | |
310 | } |
|
310 | } | |
311 |
|
311 | |||
312 | unsigned int ahbuartplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) |
|
312 | unsigned int ahbuartplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) | |
313 | { |
|
313 | { | |
314 | QTime timeout; |
|
314 | QTime timeout; | |
315 | timeout.start(); |
|
315 | timeout.start(); | |
316 | unsigned int writen=0; |
|
316 | unsigned int writen=0; | |
317 | unsigned int nextUpdateTrig=0,updateStep=512; |
|
317 | unsigned int nextUpdateTrig=0,updateStep=512; | |
318 | SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2); |
|
318 | SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2); | |
319 | if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL)) |
|
319 | if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL)) | |
320 | { |
|
320 | { | |
321 | if(!this->portMutex->tryLock()) |
|
321 | if(!this->portMutex->tryLock()) | |
322 | return 0; |
|
322 | return 0; | |
323 | if(!this->checkConnection()) |
|
323 | if(!this->checkConnection()) | |
324 | { |
|
324 | { | |
325 | emit this->activateSig(false); |
|
325 | emit this->activateSig(false); | |
326 | this->Connected = false; |
|
326 | this->Connected = false; | |
327 | this->portMutex->unlock(); |
|
327 | this->portMutex->unlock(); | |
328 | return 0; |
|
328 | return 0; | |
329 | } |
|
329 | } | |
330 | QProgressBar* progress = NULL; |
|
330 | QProgressBar* progress = NULL; | |
331 | if(count>128) |
|
331 | if(count>128) | |
332 | progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); |
|
332 | progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); | |
333 | int offset = 0; |
|
333 | int offset = 0; | |
334 | char* CMD= (char*)malloc((32*4)+5); |
|
334 | char* CMD= (char*)malloc((32*4)+5); | |
335 | while(count>32) |
|
335 | while(count>32) | |
336 | { |
|
336 | { | |
337 | writen=0; |
|
337 | writen=0; | |
338 | CMD[0] = 0xC0 | (32-1); |
|
338 | CMD[0] = 0xC0 | (32-1); | |
339 | CMD[1] = (char)(((unsigned int)address>>24)&0xFF); |
|
339 | CMD[1] = (char)(((unsigned int)address>>24)&0xFF); | |
340 | CMD[2] = (char)(((unsigned int)address>>16)&0xFF); |
|
340 | CMD[2] = (char)(((unsigned int)address>>16)&0xFF); | |
341 | CMD[3] = (char)(((unsigned int)address>>8)&0xFF); |
|
341 | CMD[3] = (char)(((unsigned int)address>>8)&0xFF); | |
342 | CMD[4] = (char)(((unsigned int)address)&0xFF); |
|
342 | CMD[4] = (char)(((unsigned int)address)&0xFF); | |
343 | for(int i=0;i<32;i++) |
|
343 | for(int i=0;i<32;i++) | |
344 | { |
|
344 | { | |
345 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); |
|
345 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); | |
346 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); |
|
346 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); | |
347 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); |
|
347 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); | |
348 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF); |
|
348 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF); | |
349 | } |
|
349 | } | |
350 | SAFEWRITE(CMD,((32*4)+5),timeout,1000,return 0); |
|
350 | SAFEWRITE(CMD,((32*4)+5),timeout,1000,return 0); | |
351 | writen+=32; |
|
351 | writen+=32; | |
352 | count-=32; |
|
352 | count-=32; | |
353 | offset+=32; |
|
353 | offset+=32; | |
354 | address+=32*4; |
|
354 | address+=32*4; | |
355 | if(offset>=nextUpdateTrig && progress!=NULL) |
|
355 | if(offset>=nextUpdateTrig && progress!=NULL) | |
356 | { |
|
356 | { | |
357 | progress->setValue(offset); |
|
357 | progress->setValue(offset); | |
358 | qApp->processEvents(); |
|
358 | qApp->processEvents(); | |
359 | nextUpdateTrig +=updateStep; |
|
359 | nextUpdateTrig +=updateStep; | |
360 | } |
|
360 | } | |
361 |
|
361 | |||
362 | } |
|
362 | } | |
363 | if(count>0) |
|
363 | if(count>0) | |
364 | { |
|
364 | { | |
365 | CMD[0] = 0xC0 | (count-1); |
|
365 | CMD[0] = 0xC0 | (count-1); | |
366 | CMD[1] = (char)(((unsigned int)address>>24)&0xFF); |
|
366 | CMD[1] = (char)(((unsigned int)address>>24)&0xFF); | |
367 | CMD[2] = (char)(((unsigned int)address>>16)&0xFF); |
|
367 | CMD[2] = (char)(((unsigned int)address>>16)&0xFF); | |
368 | CMD[3] = (char)(((unsigned int)address>>8)&0xFF); |
|
368 | CMD[3] = (char)(((unsigned int)address>>8)&0xFF); | |
369 | CMD[4] = (char)(((unsigned int)address)&0xFF); |
|
369 | CMD[4] = (char)(((unsigned int)address)&0xFF); | |
370 | for(int i=0;(unsigned int) i<(count);i++) |
|
370 | for(int i=0;(unsigned int) i<(count);i++) | |
371 | { |
|
371 | { | |
372 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); |
|
372 | CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF); | |
373 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); |
|
373 | CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF); | |
374 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); |
|
374 | CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF); | |
375 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF); |
|
375 | CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF); | |
376 | } |
|
376 | } | |
377 | SAFEWRITE(CMD,((count*4)+5),timeout,1000,return 0); |
|
377 | SAFEWRITE(CMD,((count*4)+5),timeout,1000,return 0); | |
378 | writen+=count; |
|
378 | writen+=count; | |
379 | } |
|
379 | } | |
380 | if(progress!=NULL) |
|
380 | if(progress!=NULL) | |
381 | { |
|
381 | { | |
382 | progress->setValue(writen); |
|
382 | progress->setValue(writen); | |
383 | qApp->processEvents(); |
|
383 | qApp->processEvents(); | |
384 | SocExplorerEngine::deleteProgressBar(progress); |
|
384 | SocExplorerEngine::deleteProgressBar(progress); | |
385 | } |
|
385 | } | |
386 | free(CMD); |
|
386 | free(CMD); | |
387 | this->portMutex->unlock(); |
|
387 | this->portMutex->unlock(); | |
388 | return writen; |
|
388 | return writen; | |
389 | } |
|
389 | } | |
390 | return 0; |
|
390 | return 0; | |
391 | } |
|
391 | } | |
392 |
|
392 | |||
393 |
|
393 | |||
394 |
|
394 | |||
395 |
|
395 | |||
396 | void ahbuartplugin::updatePortList() |
|
396 | void ahbuartplugin::updatePortList() | |
397 | { |
|
397 | { | |
398 | if(this->portListcompleter==(QCompleter*)NULL) |
|
398 | if(this->portListcompleter==(QCompleter*)NULL) | |
399 | { |
|
399 | { | |
400 | this->portListcompleter=new QCompleter(this); |
|
400 | this->portListcompleter=new QCompleter(this); | |
401 | this->portListcompleter->setCaseSensitivity(Qt::CaseInsensitive); |
|
401 | this->portListcompleter->setCaseSensitivity(Qt::CaseInsensitive); | |
402 | this->portListcompleterModel = new QStringListModel(this); |
|
402 | this->portListcompleterModel = new QStringListModel(this); | |
403 | this->portListcompleter->setModel(this->portListcompleterModel); |
|
403 | this->portListcompleter->setModel(this->portListcompleterModel); | |
404 | this->UI->setCompleter(this->portListcompleter); |
|
404 | this->UI->setCompleter(this->portListcompleter); | |
405 | } |
|
405 | } | |
406 | rs232portslist_t* portlist = rs232getportlist(); |
|
406 | rs232portslist_t* portlist = rs232getportlist(); | |
407 | rs232portslist_t* portlistenum = portlist; |
|
407 | rs232portslist_t* portlistenum = portlist; | |
408 | QStringList wordList; |
|
408 | QStringList wordList; | |
409 | while(portlistenum!=NULL) |
|
409 | while(portlistenum!=NULL) | |
410 | { |
|
410 | { | |
411 | wordList << portlistenum->name; |
|
411 | wordList << portlistenum->name; | |
412 | portlistenum = portlistenum->next; |
|
412 | portlistenum = portlistenum->next; | |
413 | } |
|
413 | } | |
414 | rs232deleteportlist(portlist); |
|
414 | rs232deleteportlist(portlist); | |
415 | this->portListcompleterModel->setStringList(wordList); |
|
415 | this->portListcompleterModel->setStringList(wordList); | |
416 | } |
|
416 | } | |
417 |
|
417 | |||
418 | QVariantList ahbuartplugin::ReadBytes(unsigned int address, unsigned int count) |
|
418 | QVariantList ahbuartplugin::ReadBytes(unsigned int address, unsigned int count) | |
419 | { |
|
419 | { | |
420 | unsigned int data[(count/4)+1]; |
|
420 | unsigned int data[(count/4)+1]; | |
421 | QVariantList result; |
|
421 | QVariantList result; | |
422 | this->Read(data,(count/4)+1,address); |
|
422 | this->Read(data,(count/4)+1,address); | |
423 | for(unsigned int i = 0;i<count/4;i++) |
|
423 | for(unsigned int i = 0;i<count/4;i++) | |
424 | { |
|
424 | { | |
425 | result.append(QVariant((int)(0x0FF&(data[i]>>24)))); |
|
425 | result.append(QVariant((int)(0x0FF&(data[i]>>24)))); | |
426 | result.append(QVariant((int)(0x0FF&(data[i]>>16)))); |
|
426 | result.append(QVariant((int)(0x0FF&(data[i]>>16)))); | |
427 | result.append(QVariant((int)(0x0FF&(data[i]>>8)))); |
|
427 | result.append(QVariant((int)(0x0FF&(data[i]>>8)))); | |
428 | result.append(QVariant((int)(0x0FF&(data[i])))); |
|
428 | result.append(QVariant((int)(0x0FF&(data[i])))); | |
429 | } |
|
429 | } | |
430 |
|
430 | |||
431 | for(int i=0;i<(count%4);i++) |
|
431 | for(int i=0;i<(count%4);i++) | |
432 | { |
|
432 | { | |
433 | result.append(QVariant((int)(0x0FF&(data[count/4]>>((3-i)*8))))); |
|
433 | result.append(QVariant((int)(0x0FF&(data[count/4]>>((3-i)*8))))); | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | return result; |
|
436 | return result; | |
437 | } |
|
437 | } | |
438 |
|
438 | |||
439 | void ahbuartplugin::WriteBytes(unsigned int address, QList<QVariant> dataList) |
|
439 | void ahbuartplugin::WriteBytes(unsigned int address, QList<QVariant> dataList) | |
440 | { |
|
440 | { | |
441 | unsigned int data[dataList.count()/4]; |
|
441 | unsigned int data[dataList.count()/4]; | |
442 | for(int i = 0;i<(dataList.count()/4);i++) |
|
442 | for(int i = 0;i<(dataList.count()/4);i++) | |
443 | { |
|
443 | { | |
444 | data[i] = 0x0FF & ((unsigned int)dataList.at(4*i).toUInt()); |
|
444 | data[i] = 0x0FF & ((unsigned int)dataList.at(4*i).toUInt()); | |
445 | data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+1).toUInt())); |
|
445 | data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+1).toUInt())); | |
446 | data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+2).toUInt())); |
|
446 | data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+2).toUInt())); | |
447 | data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+3).toUInt())); |
|
447 | data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+3).toUInt())); | |
448 | } |
|
448 | } | |
449 | this->Write(data,dataList.count()/4,address); |
|
449 | this->Write(data,dataList.count()/4,address); | |
450 | } |
|
450 | } | |
451 |
|
451 | |||
452 |
|
452 | |||
453 |
|
453 | |||
454 |
|
454 | |||
455 |
|
455 | |||
456 |
|
456 | |||
457 |
|
457 | |||
458 |
|
458 | |||
459 |
|
459 | |||
460 |
|
460 | |||
461 |
|
461 | |||
462 |
|
462 | |||
463 |
|
463 | |||
464 |
|
464 | |||
465 |
|
465 | |||
466 |
|
466 | |||
467 |
|
467 |
@@ -1,133 +1,133 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef AHBUARTPLUGIN_H |
|
22 | #ifndef AHBUARTPLUGIN_H | |
23 | #define AHBUARTPLUGIN_H |
|
23 | #define AHBUARTPLUGIN_H | |
24 | #include <QMenuBar> |
|
24 | #include <QMenuBar> | |
25 | #include <QMenu> |
|
25 | #include <QMenu> | |
26 | #include <QAction> |
|
26 | #include <QAction> | |
27 | #include <QLayout> |
|
27 | #include <QLayout> | |
28 | #include <QMutex> |
|
28 | #include <QMutex> | |
29 | #include <QProgressDialog> |
|
29 | #include <QProgressDialog> | |
30 | #include <QStringListModel> |
|
30 | #include <QStringListModel> | |
31 | #include <QTime> |
|
31 | #include <QTime> | |
32 | #include <socexplorerplugin.h> |
|
32 | #include <socexplorerplugin.h> | |
33 | #include "ahbuartpluginui.h" |
|
33 | #include "ahbuartpluginui.h" | |
34 |
|
34 | |||
35 | #ifdef WinRs232 |
|
35 | #ifdef WinRs232 | |
36 | #include "librs232/RS232.h" |
|
36 | #include "librs232/RS232.h" | |
37 | #else |
|
37 | #else | |
38 | #include <RS232.h> |
|
38 | #include <RS232.h> | |
39 | #undef debug |
|
39 | #undef debug | |
40 | #endif |
|
40 | #endif | |
41 |
|
41 | |||
42 |
|
42 | |||
43 |
|
43 | |||
44 |
|
44 | |||
45 | #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message) |
|
45 | #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message) | |
46 |
|
46 | |||
47 | #define APENDTABLETOLOG(table,size,Qstr,message) \ |
|
47 | #define APENDTABLETOLOG(table,size,Qstr,message) \ | |
48 | Qstr.clear();\ |
|
48 | Qstr.clear();\ | |
49 | Qstr+=message;\ |
|
49 | Qstr+=message;\ | |
50 | for(int __i__tbllog__=0;(unsigned int)__i__tbllog__<size;__i__tbllog__++)\ |
|
50 | for(int __i__tbllog__=0;(unsigned int)__i__tbllog__<size;__i__tbllog__++)\ | |
51 | {\ |
|
51 | {\ | |
52 | if(__i__tbllog__%16==0) Qstr += "\n"; \ |
|
52 | if(__i__tbllog__%16==0) Qstr += "\n"; \ | |
53 | Qstr += "0x" + QString::number((int)(0xff & table[__i__tbllog__]),16) +"\t";\ |
|
53 | Qstr += "0x" + QString::number((int)(0xff & table[__i__tbllog__]),16) +"\t";\ | |
54 | }\ |
|
54 | }\ | |
55 | APPENDTOLOG(Qstr); |
|
55 | APPENDTOLOG(Qstr); | |
56 |
|
56 | |||
57 |
|
57 | |||
58 | #define SAFEWRITE(data,count,timer,timeout,error) \ |
|
58 | #define SAFEWRITE(data,count,timer,timeout,error) \ | |
59 | while(1)\ |
|
59 | while(1)\ | |
60 | {\ |
|
60 | {\ | |
61 | unsigned int __writen__=0; \ |
|
61 | unsigned int __writen__=0; \ | |
62 | (timer).restart(); \ |
|
62 | (timer).restart(); \ | |
63 | while(__writen__!=(count)) \ |
|
63 | while(__writen__!=(count)) \ | |
64 | {\ |
|
64 | {\ | |
65 | __writen__ += rs232write(this->port,((data)+__writen__),((count)-__writen__)); \ |
|
65 | __writen__ += rs232write(this->port,((data)+__writen__),((count)-__writen__)); \ | |
66 | if((timer).elapsed()>(timeout)) \ |
|
66 | if((timer).elapsed()>(timeout)) \ | |
67 | {\ |
|
67 | {\ | |
68 | APPENDTOLOG(QString("Timeout error while writing"));\ |
|
68 | APPENDTOLOG(QString("Timeout error while writing"));\ | |
69 | this->port = (rs232port_t)NULL; \ |
|
69 | this->port = (rs232port_t)NULL; \ | |
70 | this->Connected = false; \ |
|
70 | this->Connected = false; \ | |
71 | emit this->activateSig(false); \ |
|
71 | emit this->activateSig(false); \ | |
72 | error; \ |
|
72 | error; \ | |
73 | } \ |
|
73 | } \ | |
74 | } \ |
|
74 | } \ | |
75 | break;\ |
|
75 | break;\ | |
76 | } |
|
76 | } | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | #define SAFEREAD(data,count,timer,timeout,error) \ |
|
79 | #define SAFEREAD(data,count,timer,timeout,error) \ | |
80 | unsigned int __read__=0; \ |
|
80 | unsigned int __read__=0; \ | |
81 | (timer).restart(); \ |
|
81 | (timer).restart(); \ | |
82 | while(__read__ != (count)) \ |
|
82 | while(__read__ != (count)) \ | |
83 | { \ |
|
83 | { \ | |
84 | __read__+=rs232read(this->port,((data)+__read__),((count)-__read__)); \ |
|
84 | __read__+=rs232read(this->port,((data)+__read__),((count)-__read__)); \ | |
85 | if((timer).elapsed()>(timeout)) \ |
|
85 | if((timer).elapsed()>(timeout)) \ | |
86 | { \ |
|
86 | { \ | |
87 | APPENDTOLOG(QString("Timeout error while reading"));\ |
|
87 | APPENDTOLOG(QString("Timeout error while reading"));\ | |
88 | this->Connected = false; \ |
|
88 | this->Connected = false; \ | |
89 | emit this->activateSig(false); \ |
|
89 | emit this->activateSig(false); \ | |
90 | this->portMutex->unlock(); \ |
|
90 | this->portMutex->unlock(); \ | |
91 | error; \ |
|
91 | error; \ | |
92 | } \ |
|
92 | } \ | |
93 | } \ |
|
93 | } \ | |
94 |
|
94 | |||
95 |
|
95 | |||
96 |
|
96 | |||
97 | class ahbuartplugin : public socexplorerplugin |
|
97 | class ahbuartplugin : public socexplorerplugin | |
98 | { |
|
98 | { | |
99 | Q_OBJECT |
|
99 | Q_OBJECT | |
100 | public: |
|
100 | public: | |
101 | ahbuartplugin(QWidget *parent = 0); |
|
101 | ahbuartplugin(QWidget *parent = 0); | |
102 | ~ahbuartplugin(); |
|
102 | ~ahbuartplugin(); | |
103 | int registermenu(QMainWindow *menuHolder); |
|
103 | int registermenu(QMainWindow *menuHolder); | |
104 | int VID(){return driver_VID;} |
|
104 | int VID(){return driver_VID;} | |
105 | int PID(){return driver_PID;} |
|
105 | int PID(){return driver_PID;} | |
106 |
|
106 | |||
107 | public slots: |
|
107 | public slots: | |
108 | void togglePort(QString PortName,int baudrate); |
|
108 | void togglePort(QString PortName,int baudrate); | |
109 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
109 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); | |
110 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
110 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
111 | void closeMe(); |
|
111 | void closeMe(); | |
112 | void close(); |
|
112 | void close(); | |
113 | bool open(QString PortName,int baudrate); |
|
113 | bool open(QString PortName,int baudrate); | |
114 | void updatePortList(); |
|
114 | void updatePortList(); | |
115 | QVariantList ReadBytes(unsigned int address,unsigned int count); |
|
115 | QVariantList ReadBytes(unsigned int address,unsigned int count); | |
116 | void WriteBytes(unsigned int address,QList<QVariant> dataList); |
|
116 | void WriteBytes(unsigned int address,QList<QVariant> dataList); | |
117 | signals: |
|
117 | signals: | |
118 | void setProgressValue(int progress); |
|
118 | void setProgressValue(int progress); | |
119 | private: |
|
119 | private: | |
120 | bool scanDone; |
|
120 | bool scanDone; | |
121 | QProgressDialog* progress; |
|
121 | QProgressDialog* progress; | |
122 | QLayout * mainLayout; |
|
122 | QLayout * mainLayout; | |
123 | ahbUartPluginUI* UI; |
|
123 | ahbUartPluginUI* UI; | |
124 | QMutex* portMutex; |
|
124 | QMutex* portMutex; | |
125 | rs232port_t port; |
|
125 | rs232port_t port; | |
126 | QCompleter *portListcompleter; |
|
126 | QCompleter *portListcompleter; | |
127 | QStringListModel *portListcompleterModel; |
|
127 | QStringListModel *portListcompleterModel; | |
128 | void connectPort(QString PortName,int baudrate); |
|
128 | void connectPort(QString PortName,int baudrate); | |
129 | bool checkConnection(); |
|
129 | bool checkConnection(); | |
130 |
|
130 | |||
131 | }; |
|
131 | }; | |
132 |
|
132 | |||
133 | #endif // AHBUARTPLUGIN_H |
|
133 | #endif // AHBUARTPLUGIN_H |
@@ -1,124 +1,124 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "ahbuartpluginui.h" |
|
22 | #include "ahbuartpluginui.h" | |
23 | #include "ui_ahbuartpluginui.h" |
|
23 | #include "ui_ahbuartpluginui.h" | |
24 |
|
24 | |||
25 | ahbUartPluginUI::ahbUartPluginUI(QWidget *parent) : |
|
25 | ahbUartPluginUI::ahbUartPluginUI(QWidget *parent) : | |
26 | QWidget(parent), |
|
26 | QWidget(parent), | |
27 | ui(new Ui::ahbUartPluginUI) |
|
27 | ui(new Ui::ahbUartPluginUI) | |
28 | { |
|
28 | { | |
29 | ui->setupUi(this); |
|
29 | ui->setupUi(this); | |
30 | connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort())); |
|
30 | connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort())); | |
31 | connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int))); |
|
31 | connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int))); | |
32 | connect(ui->logFileChooseBp,SIGNAL(clicked()),this,SLOT(chooseLogFile())); |
|
32 | connect(ui->logFileChooseBp,SIGNAL(clicked()),this,SLOT(chooseLogFile())); | |
33 | connect(this,SIGNAL(setLogFileName(QString)),this->ui->logFileName,SLOT(setText(QString))); |
|
33 | connect(this,SIGNAL(setLogFileName(QString)),this->ui->logFileName,SLOT(setText(QString))); | |
34 | connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts())); |
|
34 | connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts())); | |
35 | this->logFile = new QFile(); |
|
35 | this->logFile = new QFile(); | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | void ahbUartPluginUI::connectPort() |
|
38 | void ahbUartPluginUI::connectPort() | |
39 | { |
|
39 | { | |
40 | emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value()); |
|
40 | emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value()); | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | void ahbUartPluginUI::setConnected(bool connected) |
|
43 | void ahbUartPluginUI::setConnected(bool connected) | |
44 | { |
|
44 | { | |
45 | if(connected == true) |
|
45 | if(connected == true) | |
46 | { |
|
46 | { | |
47 | ui->OpenPort->setText(tr("Close port")); |
|
47 | ui->OpenPort->setText(tr("Close port")); | |
48 | } |
|
48 | } | |
49 | else |
|
49 | else | |
50 | ui->OpenPort->setText(tr("Open port")); |
|
50 | ui->OpenPort->setText(tr("Open port")); | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 |
|
53 | |||
54 | ahbUartPluginUI::~ahbUartPluginUI() |
|
54 | ahbUartPluginUI::~ahbUartPluginUI() | |
55 | { |
|
55 | { | |
56 | delete ui; |
|
56 | delete ui; | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | void ahbUartPluginUI::chooseLogFile() |
|
60 | void ahbUartPluginUI::chooseLogFile() | |
61 | { |
|
61 | { | |
62 | if(this->logFile->isOpen()) |
|
62 | if(this->logFile->isOpen()) | |
63 | this->logFile->close(); |
|
63 | this->logFile->close(); | |
64 | this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),QDir::homePath(), tr("Log Files (*.txt *.log)"))); |
|
64 | this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),QDir::homePath(), tr("Log Files (*.txt *.log)"))); | |
65 | if(this->logFile->open(QIODevice::WriteOnly)) |
|
65 | if(this->logFile->open(QIODevice::WriteOnly)) | |
66 | { |
|
66 | { | |
67 | this->logFileStrm = new QTextStream(this->logFile); |
|
67 | this->logFileStrm = new QTextStream(this->logFile); | |
68 | emit this->setLogFileName(this->logFile->fileName()); |
|
68 | emit this->setLogFileName(this->logFile->fileName()); | |
69 | } |
|
69 | } | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | void ahbUartPluginUI::setconfig(QString PortName, int baudrate) |
|
72 | void ahbUartPluginUI::setconfig(QString PortName, int baudrate) | |
73 | { |
|
73 | { | |
74 | this->ui->PortName->setText(PortName); |
|
74 | this->ui->PortName->setText(PortName); | |
75 | this->ui->PortspeedSlider->setValue(baudrate); |
|
75 | this->ui->PortspeedSlider->setValue(baudrate); | |
76 | } |
|
76 | } | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | void ahbUartPluginUI::logFileEnDisable(int state) |
|
79 | void ahbUartPluginUI::logFileEnDisable(int state) | |
80 | { |
|
80 | { | |
81 | if(state==Qt::Checked) |
|
81 | if(state==Qt::Checked) | |
82 | { |
|
82 | { | |
83 | this->logFileEn = true; |
|
83 | this->logFileEn = true; | |
84 | } |
|
84 | } | |
85 | else if(state==Qt::Unchecked) |
|
85 | else if(state==Qt::Unchecked) | |
86 | { |
|
86 | { | |
87 | this->logFileEn = false; |
|
87 | this->logFileEn = false; | |
88 | } |
|
88 | } | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | bool ahbUartPluginUI::islogfileenable() |
|
91 | bool ahbUartPluginUI::islogfileenable() | |
92 | { |
|
92 | { | |
93 | return this->logFileEn; |
|
93 | return this->logFileEn; | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | void ahbUartPluginUI::appendToLogFile(const QString & text) |
|
96 | void ahbUartPluginUI::appendToLogFile(const QString & text) | |
97 | { |
|
97 | { | |
98 | if(this->logFileEn && this->logFile->isOpen()) |
|
98 | if(this->logFileEn && this->logFile->isOpen()) | |
99 | { |
|
99 | { | |
100 | *(this->logFileStrm) << text << endl; |
|
100 | *(this->logFileStrm) << text << endl; | |
101 | } |
|
101 | } | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | void ahbUartPluginUI::setCompleter(QCompleter *completer) |
|
104 | void ahbUartPluginUI::setCompleter(QCompleter *completer) | |
105 | { |
|
105 | { | |
106 | this->ui->PortName->setCompleter(completer); |
|
106 | this->ui->PortName->setCompleter(completer); | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | void ahbUartPluginUI::closeEvent(QCloseEvent *event) |
|
109 | void ahbUartPluginUI::closeEvent(QCloseEvent *event) | |
110 | { |
|
110 | { | |
111 | if(this->logFile->isOpen()) |
|
111 | if(this->logFile->isOpen()) | |
112 | { |
|
112 | { | |
113 | this->logFileStrm->flush(); |
|
113 | this->logFileStrm->flush(); | |
114 | this->logFile->waitForBytesWritten(3000); |
|
114 | this->logFile->waitForBytesWritten(3000); | |
115 | this->logFile->close(); |
|
115 | this->logFile->close(); | |
116 | } |
|
116 | } | |
117 | event->accept(); |
|
117 | event->accept(); | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 |
|
120 | |||
121 |
|
121 | |||
122 |
|
122 | |||
123 |
|
123 | |||
124 |
|
124 |
@@ -1,71 +1,71 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef AHBUARTPLUGINUI_H |
|
22 | #ifndef AHBUARTPLUGINUI_H | |
23 | #define AHBUARTPLUGINUI_H |
|
23 | #define AHBUARTPLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QFile> |
|
26 | #include <QFile> | |
27 | #include <QTextStream> |
|
27 | #include <QTextStream> | |
28 | #include <QFileDialog> |
|
28 | #include <QFileDialog> | |
29 | #include <QDir> |
|
29 | #include <QDir> | |
30 | #include <QCloseEvent> |
|
30 | #include <QCloseEvent> | |
31 | #include <QCompleter> |
|
31 | #include <QCompleter> | |
32 |
|
32 | |||
33 | namespace Ui { |
|
33 | namespace Ui { | |
34 | class ahbUartPluginUI; |
|
34 | class ahbUartPluginUI; | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | class ahbUartPluginUI : public QWidget |
|
37 | class ahbUartPluginUI : public QWidget | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 |
|
40 | |||
41 | public: |
|
41 | public: | |
42 | explicit ahbUartPluginUI(QWidget *parent = 0); |
|
42 | explicit ahbUartPluginUI(QWidget *parent = 0); | |
43 | ~ahbUartPluginUI(); |
|
43 | ~ahbUartPluginUI(); | |
44 | bool islogfileenable(); |
|
44 | bool islogfileenable(); | |
45 | void appendToLogFile(const QString & text); |
|
45 | void appendToLogFile(const QString & text); | |
46 | void closeEvent(QCloseEvent *event); |
|
46 | void closeEvent(QCloseEvent *event); | |
47 | void setCompleter(QCompleter* completer); |
|
47 | void setCompleter(QCompleter* completer); | |
48 | public slots: |
|
48 | public slots: | |
49 | void setConnected(bool connected); |
|
49 | void setConnected(bool connected); | |
50 | void connectPort(); |
|
50 | void connectPort(); | |
51 | void chooseLogFile(); |
|
51 | void chooseLogFile(); | |
52 | void logFileEnDisable(int state); |
|
52 | void logFileEnDisable(int state); | |
53 | void setconfig(QString PortName,int baudrate); |
|
53 | void setconfig(QString PortName,int baudrate); | |
54 |
|
54 | |||
55 | signals: |
|
55 | signals: | |
56 | void connectPortsig(QString PortName,int baudrate); |
|
56 | void connectPortsig(QString PortName,int baudrate); | |
57 | void setLogFileName(QString FileName); |
|
57 | void setLogFileName(QString FileName); | |
58 | void rescanPorts(); |
|
58 | void rescanPorts(); | |
59 | private: |
|
59 | private: | |
60 | Ui::ahbUartPluginUI *ui; |
|
60 | Ui::ahbUartPluginUI *ui; | |
61 | QFile* logFile; |
|
61 | QFile* logFile; | |
62 | QTextStream* logFileStrm; |
|
62 | QTextStream* logFileStrm; | |
63 | bool logFileEn; |
|
63 | bool logFileEn; | |
64 | }; |
|
64 | }; | |
65 |
|
65 | |||
66 | #endif // AHBUARTPLUGINUI_H |
|
66 | #endif // AHBUARTPLUGINUI_H | |
67 |
|
67 | |||
68 |
|
68 | |||
69 |
|
69 | |||
70 |
|
70 | |||
71 |
|
71 |
@@ -1,32 +1,32 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "ahbuartpywrapper.h" |
|
22 | #include "ahbuartpywrapper.h" | |
23 | #include <QObject> |
|
23 | #include <QObject> | |
24 | #include <QFile> |
|
24 | #include <QFile> | |
25 | #include <QTextStream> |
|
25 | #include <QTextStream> | |
26 | #include <byteswap.h> |
|
26 | #include <byteswap.h> | |
27 | #include <stdint.h> |
|
27 | #include <stdint.h> | |
28 |
|
28 | |||
29 | ahbuartPywrapper::ahbuartPywrapper(socexplorerplugin *parent) : |
|
29 | ahbuartPywrapper::ahbuartPywrapper(socexplorerplugin *parent) : | |
30 | genericPySysdriver(parent) |
|
30 | genericPySysdriver(parent) | |
31 | { |
|
31 | { | |
32 | } |
|
32 | } |
@@ -1,74 +1,74 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "ahbdevicelist.h" |
|
22 | #include "ahbdevicelist.h" | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
|
25 | |||
26 | ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent) |
|
26 | ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent) | |
27 | { |
|
27 | { | |
28 | this->setColumnCount(7); |
|
28 | this->setColumnCount(7); | |
29 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID")); |
|
29 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID")); | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | void ahbdevicelist::clearAHBdevicesList() |
|
32 | void ahbdevicelist::clearAHBdevicesList() | |
33 | { |
|
33 | { | |
34 | this->clear(); |
|
34 | this->clear(); | |
35 | this->setRowCount(0); |
|
35 | this->setRowCount(0); | |
36 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID")); |
|
36 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("BAR1")<<tr("BAR2")<<tr("BAR3")<<tr("Vendor ID")<<tr("Product ID")); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device) |
|
39 | void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device) | |
40 | { |
|
40 | { | |
41 | if(this->rowCount()==0) |
|
41 | if(this->rowCount()==0) | |
42 | { |
|
42 | { | |
43 | this->setRowCount(1); |
|
43 | this->setRowCount(1); | |
44 | } |
|
44 | } | |
45 | else |
|
45 | else | |
46 | { |
|
46 | { | |
47 | this->insertRow(this->rowCount()); |
|
47 | this->insertRow(this->rowCount()); | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | this->ahbdevices.append(device); |
|
50 | this->ahbdevices.append(device); | |
51 | QTableWidgetItem *newItem = new QTableWidgetItem(*device->deviceName); |
|
51 | QTableWidgetItem *newItem = new QTableWidgetItem(*device->deviceName); | |
52 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
52 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
53 | this->setItem(this->rowCount()-1, 0, newItem); |
|
53 | this->setItem(this->rowCount()-1, 0, newItem); | |
54 |
|
54 | |||
55 | for(int i=0;i<4;i++) |
|
55 | for(int i=0;i<4;i++) | |
56 | { |
|
56 | { | |
57 | if(device->BAR[i].size!=0) |
|
57 | if(device->BAR[i].size!=0) | |
58 | { |
|
58 | { | |
59 | newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)+" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)+" size = "+device->barAdressSize(i)); |
|
59 | newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)+" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)+" size = "+device->barAdressSize(i)); | |
60 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
60 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
61 | this->setItem(this->rowCount()-1, i+1, newItem); |
|
61 | this->setItem(this->rowCount()-1, i+1, newItem); | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16)); |
|
66 | newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16)); | |
67 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
67 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
68 | this->setItem(this->rowCount()-1, 5, newItem); |
|
68 | this->setItem(this->rowCount()-1, 5, newItem); | |
69 | newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16)); |
|
69 | newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16)); | |
70 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
70 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
71 | this->setItem(this->rowCount()-1, 6, newItem); |
|
71 | this->setItem(this->rowCount()-1, 6, newItem); | |
72 | this->resizeColumnsToContents(); |
|
72 | this->resizeColumnsToContents(); | |
73 |
|
73 | |||
74 | } |
|
74 | } |
@@ -1,104 +1,104 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef AHBDEVICELIST_H |
|
22 | #ifndef AHBDEVICELIST_H | |
23 | #define AHBDEVICELIST_H |
|
23 | #define AHBDEVICELIST_H | |
24 | #include <QTableWidget> |
|
24 | #include <QTableWidget> | |
25 | #include <QString> |
|
25 | #include <QString> | |
26 | #include <QList> |
|
26 | #include <QList> | |
27 |
|
27 | |||
28 | typedef struct |
|
28 | typedef struct | |
29 | { |
|
29 | { | |
30 | unsigned int address; |
|
30 | unsigned int address; | |
31 | unsigned int size; |
|
31 | unsigned int size; | |
32 | unsigned char type; |
|
32 | unsigned char type; | |
33 | bool prefectchable; |
|
33 | bool prefectchable; | |
34 | bool cacheable; |
|
34 | bool cacheable; | |
35 |
|
35 | |||
36 | }AHBbarreg; |
|
36 | }AHBbarreg; | |
37 |
|
37 | |||
38 | class ahbdeviceInfo |
|
38 | class ahbdeviceInfo | |
39 | { |
|
39 | { | |
40 | public: |
|
40 | public: | |
41 | ahbdeviceInfo() |
|
41 | ahbdeviceInfo() | |
42 | { |
|
42 | { | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | ahbdeviceInfo(const QString deviceName,AHBbarreg BAR0,AHBbarreg BAR1, AHBbarreg BAR2,AHBbarreg BAR3,int VID,int PID) |
|
45 | ahbdeviceInfo(const QString deviceName,AHBbarreg BAR0,AHBbarreg BAR1, AHBbarreg BAR2,AHBbarreg BAR3,int VID,int PID) | |
46 | { |
|
46 | { | |
47 | this->deviceName = new QString(deviceName); |
|
47 | this->deviceName = new QString(deviceName); | |
48 | this->BAR[0]=BAR0; |
|
48 | this->BAR[0]=BAR0; | |
49 | this->BAR[1]=BAR1; |
|
49 | this->BAR[1]=BAR1; | |
50 | this->BAR[2]=BAR2; |
|
50 | this->BAR[2]=BAR2; | |
51 | this->BAR[3]=BAR3; |
|
51 | this->BAR[3]=BAR3; | |
52 | this->VID = VID; |
|
52 | this->VID = VID; | |
53 | this->PID = PID; |
|
53 | this->PID = PID; | |
54 | } |
|
54 | } | |
55 | QString barAdressSize(int barIndex) |
|
55 | QString barAdressSize(int barIndex) | |
56 | { |
|
56 | { | |
57 | int k=0; |
|
57 | int k=0; | |
58 | unsigned int size=this->BAR[barIndex].size; |
|
58 | unsigned int size=this->BAR[barIndex].size; | |
59 | while(size>=1024){size=size>>10;k++;} |
|
59 | while(size>=1024){size=size>>10;k++;} | |
60 | switch(k) |
|
60 | switch(k) | |
61 | { |
|
61 | { | |
62 | case 0: |
|
62 | case 0: | |
63 | return (QString::number(size, 10) + "B"); |
|
63 | return (QString::number(size, 10) + "B"); | |
64 | break; |
|
64 | break; | |
65 | case 1: |
|
65 | case 1: | |
66 | return (QString::number(size, 10) + "kB"); |
|
66 | return (QString::number(size, 10) + "kB"); | |
67 | break; |
|
67 | break; | |
68 | case 2: |
|
68 | case 2: | |
69 | return (QString::number(size, 10) + "MB"); |
|
69 | return (QString::number(size, 10) + "MB"); | |
70 | break; |
|
70 | break; | |
71 | case 3: |
|
71 | case 3: | |
72 | return (QString::number(size, 10) + "GB"); |
|
72 | return (QString::number(size, 10) + "GB"); | |
73 | break; |
|
73 | break; | |
74 | case 4: |
|
74 | case 4: | |
75 | return (QString::number(size, 10) + "TB"); |
|
75 | return (QString::number(size, 10) + "TB"); | |
76 | break; |
|
76 | break; | |
77 | default: |
|
77 | default: | |
78 | return (QString::number(this->BAR[barIndex].size, 10) + "B"); |
|
78 | return (QString::number(this->BAR[barIndex].size, 10) + "B"); | |
79 | break; |
|
79 | break; | |
80 | } |
|
80 | } | |
81 | } |
|
81 | } | |
82 | QString* deviceName; |
|
82 | QString* deviceName; | |
83 | AHBbarreg BAR[4]; |
|
83 | AHBbarreg BAR[4]; | |
84 | int VID; |
|
84 | int VID; | |
85 | int PID; |
|
85 | int PID; | |
86 | }; |
|
86 | }; | |
87 |
|
87 | |||
88 | class ahbdevicelist: public QTableWidget |
|
88 | class ahbdevicelist: public QTableWidget | |
89 | { |
|
89 | { | |
90 | Q_OBJECT |
|
90 | Q_OBJECT | |
91 | public: |
|
91 | public: | |
92 | explicit ahbdevicelist(QWidget * parent = 0); |
|
92 | explicit ahbdevicelist(QWidget * parent = 0); | |
93 |
|
93 | |||
94 | public slots: |
|
94 | public slots: | |
95 | void addAHBdevice(ahbdeviceInfo* device); |
|
95 | void addAHBdevice(ahbdeviceInfo* device); | |
96 | void clearAHBdevicesList(); |
|
96 | void clearAHBdevicesList(); | |
97 |
|
97 | |||
98 | private: |
|
98 | private: | |
99 | QList<ahbdeviceInfo*> ahbdevices; |
|
99 | QList<ahbdeviceInfo*> ahbdevices; | |
100 |
|
100 | |||
101 |
|
101 | |||
102 | }; |
|
102 | }; | |
103 |
|
103 | |||
104 | #endif // AHBDEVICELIST_H |
|
104 | #endif // AHBDEVICELIST_H |
@@ -1,90 +1,90 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "ahbpluginui.h" |
|
22 | #include "ahbpluginui.h" | |
23 | #include <socexplorerengine.h> |
|
23 | #include <socexplorerengine.h> | |
24 |
|
24 | |||
25 | ahbPluginUi::ahbPluginUi(socexplorerplugin *plugin, QWidget *parent) : |
|
25 | ahbPluginUi::ahbPluginUi(socexplorerplugin *plugin, QWidget *parent) : | |
26 | QWidget(parent) |
|
26 | QWidget(parent) | |
27 | { |
|
27 | { | |
28 | this->mainlayout = new QHBoxLayout; |
|
28 | this->mainlayout = new QHBoxLayout; | |
29 | this->scanBp = new QPushButton(tr("Scan AHB")); |
|
29 | this->scanBp = new QPushButton(tr("Scan AHB")); | |
30 | this->deviceslst = new ahbdevicelist; |
|
30 | this->deviceslst = new ahbdevicelist; | |
31 | this->mainlayout->addWidget(this->deviceslst); |
|
31 | this->mainlayout->addWidget(this->deviceslst); | |
32 | this->mainlayout->addWidget(this->scanBp); |
|
32 | this->mainlayout->addWidget(this->scanBp); | |
33 | this->setLayout(this->mainlayout); |
|
33 | this->setLayout(this->mainlayout); | |
34 | this->_plugin = plugin; |
|
34 | this->_plugin = plugin; | |
35 | connect(this,SIGNAL(addAHBdevice(ahbdeviceInfo*)),this->deviceslst,SLOT(addAHBdevice(ahbdeviceInfo*))); |
|
35 | connect(this,SIGNAL(addAHBdevice(ahbdeviceInfo*)),this->deviceslst,SLOT(addAHBdevice(ahbdeviceInfo*))); | |
36 | connect(this,SIGNAL(clearAHBdevicesList()),this->deviceslst,SLOT(clearAHBdevicesList())); |
|
36 | connect(this,SIGNAL(clearAHBdevicesList()),this->deviceslst,SLOT(clearAHBdevicesList())); | |
37 | connect(this->scanBp,SIGNAL(clicked()),this,SLOT(scanAHB())); |
|
37 | connect(this->scanBp,SIGNAL(clicked()),this,SLOT(scanAHB())); | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 |
|
40 | |||
41 |
|
41 | |||
42 | ahbdeviceInfo* ahbPluginUi::extractInfos(int *pnpregs) |
|
42 | ahbdeviceInfo* ahbPluginUi::extractInfos(int *pnpregs) | |
43 | { |
|
43 | { | |
44 | AHBbarreg BAR[4]; |
|
44 | AHBbarreg BAR[4]; | |
45 |
|
45 | |||
46 | int VID; |
|
46 | int VID; | |
47 | int PID; |
|
47 | int PID; | |
48 | for(int i=0;i<4;i++) |
|
48 | for(int i=0;i<4;i++) | |
49 | { |
|
49 | { | |
50 | BAR[i].address = pnpregs[i+4] & 0xfff00000; |
|
50 | BAR[i].address = pnpregs[i+4] & 0xfff00000; | |
51 | BAR[i].size = (pnpregs[i+4] & 0x0000fff0)<<16; |
|
51 | BAR[i].size = (pnpregs[i+4] & 0x0000fff0)<<16; | |
52 | if(BAR[i].size!=0) |
|
52 | if(BAR[i].size!=0) | |
53 | BAR[i].size = (((-1^BAR[i].size)|BAR[i].address)-BAR[i].address)+1; |
|
53 | BAR[i].size = (((-1^BAR[i].size)|BAR[i].address)-BAR[i].address)+1; | |
54 | BAR[i].cacheable = (bool)((pnpregs[i+4]&0x00010000)>>16); |
|
54 | BAR[i].cacheable = (bool)((pnpregs[i+4]&0x00010000)>>16); | |
55 | BAR[i].prefectchable = (bool)((pnpregs[i+4]&0x00020000)>>17); |
|
55 | BAR[i].prefectchable = (bool)((pnpregs[i+4]&0x00020000)>>17); | |
56 | BAR[i].type = (unsigned char)(pnpregs[i+4]&0xf); |
|
56 | BAR[i].type = (unsigned char)(pnpregs[i+4]&0xf); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | VID = (pnpregs[0]>>24)&0xff; |
|
59 | VID = (pnpregs[0]>>24)&0xff; | |
60 | PID = (pnpregs[0]>>12)&0xfff; |
|
60 | PID = (pnpregs[0]>>12)&0xfff; | |
61 | QString devname = SocExplorerEngine::getDevName(VID,PID); |
|
61 | QString devname = SocExplorerEngine::getDevName(VID,PID); | |
62 | return new ahbdeviceInfo(devname,BAR[0],BAR[1],BAR[2],BAR[3],VID,PID); |
|
62 | return new ahbdeviceInfo(devname,BAR[0],BAR[1],BAR[2],BAR[3],VID,PID); | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 |
|
65 | |||
66 | void ahbPluginUi::scanAHB() |
|
66 | void ahbPluginUi::scanAHB() | |
67 | { |
|
67 | { | |
68 | unsigned int size = AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START; |
|
68 | unsigned int size = AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START; | |
69 | int j=0; |
|
69 | int j=0; | |
70 | unsigned long long i = AHB_PLUGNPLAY_MASTER_START; |
|
70 | unsigned long long i = AHB_PLUGNPLAY_MASTER_START; | |
71 | int pnpregs[AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START]; |
|
71 | int pnpregs[AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START]; | |
72 | emit this->clearAHBdevicesList(); |
|
72 | emit this->clearAHBdevicesList(); | |
73 | if( this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)AHB_PLUGNPLAY_MASTER_START)==size) |
|
73 | if( this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)AHB_PLUGNPLAY_MASTER_START)==size) | |
74 | { |
|
74 | { | |
75 | while(i<AHB_PLUGNPLAY_SLAVE_STOP) |
|
75 | while(i<AHB_PLUGNPLAY_SLAVE_STOP) | |
76 | { |
|
76 | { | |
77 | if(pnpregs[j]!=0) |
|
77 | if(pnpregs[j]!=0) | |
78 | { |
|
78 | { | |
79 | ahbdeviceInfo* devinfo=this->extractInfos(pnpregs+j); |
|
79 | ahbdeviceInfo* devinfo=this->extractInfos(pnpregs+j); | |
80 | if(!devinfo->deviceName->compare("DSU3")) |
|
80 | if(!devinfo->deviceName->compare("DSU3")) | |
81 | SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[0].address,*devinfo->deviceName); |
|
81 | SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[0].address,*devinfo->deviceName); | |
82 | emit this->addAHBdevice(devinfo); |
|
82 | emit this->addAHBdevice(devinfo); | |
83 | } |
|
83 | } | |
84 | i+=32; |
|
84 | i+=32; | |
85 | j+=8; |
|
85 | j+=8; | |
86 | } |
|
86 | } | |
87 | } |
|
87 | } | |
88 | } |
|
88 | } | |
89 |
|
89 | |||
90 |
|
90 |
@@ -1,59 +1,59 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef AHBPLUGINUI_H |
|
22 | #ifndef AHBPLUGINUI_H | |
23 | #define AHBPLUGINUI_H |
|
23 | #define AHBPLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QHBoxLayout> |
|
26 | #include <QHBoxLayout> | |
27 | #include <QPushButton> |
|
27 | #include <QPushButton> | |
28 | #include "ahbdevicelist.h" |
|
28 | #include "ahbdevicelist.h" | |
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 | #define AHB_PLUGNPLAY_MASTER_START ((unsigned int)(0xFFFFF000)) |
|
30 | #define AHB_PLUGNPLAY_MASTER_START ((unsigned int)(0xFFFFF000)) | |
31 | #define AHB_PLUGNPLAY_MASTER_STOP ((unsigned int)(0xFFFFF800)) |
|
31 | #define AHB_PLUGNPLAY_MASTER_STOP ((unsigned int)(0xFFFFF800)) | |
32 | #define AHB_PLUGNPLAY_SLAVE_START ((unsigned int)(0xFFFFF800)) |
|
32 | #define AHB_PLUGNPLAY_SLAVE_START ((unsigned int)(0xFFFFF800)) | |
33 |
|
33 | |||
34 | #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC)) |
|
34 | #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC)) | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | class ahbPluginUi : public QWidget |
|
37 | class ahbPluginUi : public QWidget | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | public: |
|
40 | public: | |
41 | explicit ahbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0); |
|
41 | explicit ahbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0); | |
42 | ahbdeviceInfo* extractInfos(int* pnpregs); |
|
42 | ahbdeviceInfo* extractInfos(int* pnpregs); | |
43 | public slots: |
|
43 | public slots: | |
44 | void scanAHB(); |
|
44 | void scanAHB(); | |
45 | signals: |
|
45 | signals: | |
46 | void addAHBdevice(ahbdeviceInfo* device); |
|
46 | void addAHBdevice(ahbdeviceInfo* device); | |
47 | void clearAHBdevicesList(); |
|
47 | void clearAHBdevicesList(); | |
48 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
48 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); | |
49 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
49 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); | |
50 | private: |
|
50 | private: | |
51 | QHBoxLayout* mainlayout; |
|
51 | QHBoxLayout* mainlayout; | |
52 | QPushButton* scanBp; |
|
52 | QPushButton* scanBp; | |
53 | ahbdevicelist* deviceslst; |
|
53 | ahbdevicelist* deviceslst; | |
54 | socexplorerplugin* _plugin; |
|
54 | socexplorerplugin* _plugin; | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | }; |
|
57 | }; | |
58 |
|
58 | |||
59 | #endif // AHBPLUGINUI_H |
|
59 | #endif // AHBPLUGINUI_H |
@@ -1,74 +1,74 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "apbdevicelist.h" |
|
22 | #include "apbdevicelist.h" | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
|
25 | |||
26 | apbdevicelist::apbdevicelist(QWidget *parent):QTableWidget(parent) |
|
26 | apbdevicelist::apbdevicelist(QWidget *parent):QTableWidget(parent) | |
27 | { |
|
27 | { | |
28 | this->setColumnCount(4); |
|
28 | this->setColumnCount(4); | |
29 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID")); |
|
29 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID")); | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | void apbdevicelist::clearAPBdevicesList() |
|
32 | void apbdevicelist::clearAPBdevicesList() | |
33 | { |
|
33 | { | |
34 | this->clear(); |
|
34 | this->clear(); | |
35 | this->setRowCount(0); |
|
35 | this->setRowCount(0); | |
36 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID")); |
|
36 | this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID")); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void apbdevicelist::addAPBdevice(apbdeviceInfo* device) |
|
39 | void apbdevicelist::addAPBdevice(apbdeviceInfo* device) | |
40 | { |
|
40 | { | |
41 | if(this->rowCount()==0) |
|
41 | if(this->rowCount()==0) | |
42 | { |
|
42 | { | |
43 | this->setRowCount(1); |
|
43 | this->setRowCount(1); | |
44 | } |
|
44 | } | |
45 | else |
|
45 | else | |
46 | { |
|
46 | { | |
47 | this->insertRow(this->rowCount()); |
|
47 | this->insertRow(this->rowCount()); | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | this->apbdevices.append(device); |
|
50 | this->apbdevices.append(device); | |
51 | QTableWidgetItem *newItem = new QTableWidgetItem(device->deviceName); |
|
51 | QTableWidgetItem *newItem = new QTableWidgetItem(device->deviceName); | |
52 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
52 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
53 | this->setItem(this->rowCount()-1, 0, newItem); |
|
53 | this->setItem(this->rowCount()-1, 0, newItem); | |
54 |
|
54 | |||
55 | for(int i=0;i<1;i++) |
|
55 | for(int i=0;i<1;i++) | |
56 | { |
|
56 | { | |
57 | if(device->BAR[i].size!=0) |
|
57 | if(device->BAR[i].size!=0) | |
58 | { |
|
58 | { | |
59 | newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)+" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)+" size = "+device->barAdressSize(i)); |
|
59 | newItem = new QTableWidgetItem("0x" + QString::number(device->BAR[i].address, 16)+" -> 0x"+ QString::number(device->BAR[i].address + device->BAR[i].size-1, 16)+" size = "+device->barAdressSize(i)); | |
60 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
60 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
61 | this->setItem(this->rowCount()-1, i+1, newItem); |
|
61 | this->setItem(this->rowCount()-1, i+1, newItem); | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16)); |
|
66 | newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16)); | |
67 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
67 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
68 | this->setItem(this->rowCount()-1, 2, newItem); |
|
68 | this->setItem(this->rowCount()-1, 2, newItem); | |
69 | newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16)); |
|
69 | newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16)); | |
70 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
70 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
71 | this->setItem(this->rowCount()-1, 3, newItem); |
|
71 | this->setItem(this->rowCount()-1, 3, newItem); | |
72 | this->resizeColumnsToContents(); |
|
72 | this->resizeColumnsToContents(); | |
73 |
|
73 | |||
74 | } |
|
74 | } |
@@ -1,99 +1,99 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBDEVICELIST_H |
|
22 | #ifndef APBDEVICELIST_H | |
23 | #define APBDEVICELIST_H |
|
23 | #define APBDEVICELIST_H | |
24 | #include <QTableWidget> |
|
24 | #include <QTableWidget> | |
25 | #include <QString> |
|
25 | #include <QString> | |
26 | #include <QList> |
|
26 | #include <QList> | |
27 |
|
27 | |||
28 | typedef struct |
|
28 | typedef struct | |
29 | { |
|
29 | { | |
30 | unsigned int address; |
|
30 | unsigned int address; | |
31 | unsigned int size; |
|
31 | unsigned int size; | |
32 | unsigned char type; |
|
32 | unsigned char type; | |
33 |
|
33 | |||
34 | }APBbarreg; |
|
34 | }APBbarreg; | |
35 |
|
35 | |||
36 | class apbdeviceInfo |
|
36 | class apbdeviceInfo | |
37 | { |
|
37 | { | |
38 | public: |
|
38 | public: | |
39 | apbdeviceInfo() |
|
39 | apbdeviceInfo() | |
40 | { |
|
40 | { | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | apbdeviceInfo(const QString deviceName,APBbarreg BAR0,int VID,int PID) |
|
43 | apbdeviceInfo(const QString deviceName,APBbarreg BAR0,int VID,int PID) | |
44 | { |
|
44 | { | |
45 | this->deviceName = deviceName; |
|
45 | this->deviceName = deviceName; | |
46 | this->BAR[0]=BAR0; |
|
46 | this->BAR[0]=BAR0; | |
47 | this->VID = VID; |
|
47 | this->VID = VID; | |
48 | this->PID = PID; |
|
48 | this->PID = PID; | |
49 | } |
|
49 | } | |
50 | QString barAdressSize(int barIndex) |
|
50 | QString barAdressSize(int barIndex) | |
51 | { |
|
51 | { | |
52 | int k=0; |
|
52 | int k=0; | |
53 | unsigned int size=this->BAR[barIndex].size; |
|
53 | unsigned int size=this->BAR[barIndex].size; | |
54 | while(size>=1024){size=size>>10;k++;} |
|
54 | while(size>=1024){size=size>>10;k++;} | |
55 | switch(k) |
|
55 | switch(k) | |
56 | { |
|
56 | { | |
57 | case 0: |
|
57 | case 0: | |
58 | return (QString::number(size, 10) + "B"); |
|
58 | return (QString::number(size, 10) + "B"); | |
59 | break; |
|
59 | break; | |
60 | case 1: |
|
60 | case 1: | |
61 | return (QString::number(size, 10) + "kB"); |
|
61 | return (QString::number(size, 10) + "kB"); | |
62 | break; |
|
62 | break; | |
63 | case 2: |
|
63 | case 2: | |
64 | return (QString::number(size, 10) + "MB"); |
|
64 | return (QString::number(size, 10) + "MB"); | |
65 | break; |
|
65 | break; | |
66 | case 3: |
|
66 | case 3: | |
67 | return (QString::number(size, 10) + "GB"); |
|
67 | return (QString::number(size, 10) + "GB"); | |
68 | break; |
|
68 | break; | |
69 | case 4: |
|
69 | case 4: | |
70 | return (QString::number(size, 10) + "TB"); |
|
70 | return (QString::number(size, 10) + "TB"); | |
71 | break; |
|
71 | break; | |
72 | default: |
|
72 | default: | |
73 | return (QString::number(this->BAR[barIndex].size, 10) + "B"); |
|
73 | return (QString::number(this->BAR[barIndex].size, 10) + "B"); | |
74 | break; |
|
74 | break; | |
75 | } |
|
75 | } | |
76 | } |
|
76 | } | |
77 | QString deviceName; |
|
77 | QString deviceName; | |
78 | APBbarreg BAR[1]; |
|
78 | APBbarreg BAR[1]; | |
79 | int VID; |
|
79 | int VID; | |
80 | int PID; |
|
80 | int PID; | |
81 | }; |
|
81 | }; | |
82 |
|
82 | |||
83 | class apbdevicelist: public QTableWidget |
|
83 | class apbdevicelist: public QTableWidget | |
84 | { |
|
84 | { | |
85 | Q_OBJECT |
|
85 | Q_OBJECT | |
86 | public: |
|
86 | public: | |
87 | explicit apbdevicelist(QWidget * parent = 0); |
|
87 | explicit apbdevicelist(QWidget * parent = 0); | |
88 |
|
88 | |||
89 | public slots: |
|
89 | public slots: | |
90 | void addAPBdevice(apbdeviceInfo* device); |
|
90 | void addAPBdevice(apbdeviceInfo* device); | |
91 | void clearAPBdevicesList(); |
|
91 | void clearAPBdevicesList(); | |
92 |
|
92 | |||
93 | private: |
|
93 | private: | |
94 | QList<apbdeviceInfo*> apbdevices; |
|
94 | QList<apbdeviceInfo*> apbdevices; | |
95 |
|
95 | |||
96 |
|
96 | |||
97 | }; |
|
97 | }; | |
98 |
|
98 | |||
99 | #endif // APBDEVICELIST_H |
|
99 | #endif // APBDEVICELIST_H |
@@ -1,99 +1,99 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "apbpluginui.h" |
|
22 | #include "apbpluginui.h" | |
23 | #include <stdint.h> |
|
23 | #include <stdint.h> | |
24 | #include <socexplorerengine.h> |
|
24 | #include <socexplorerengine.h> | |
25 |
|
25 | |||
26 | apbPluginUi::apbPluginUi(socexplorerplugin *plugin, QWidget *parent) : |
|
26 | apbPluginUi::apbPluginUi(socexplorerplugin *plugin, QWidget *parent) : | |
27 | QWidget(parent) |
|
27 | QWidget(parent) | |
28 | { |
|
28 | { | |
29 | this->setWindowTitle(tr("APB Driver")); |
|
29 | this->setWindowTitle(tr("APB Driver")); | |
30 | this->mainlayout = new QHBoxLayout; |
|
30 | this->mainlayout = new QHBoxLayout; | |
31 | this->scanBp = new QPushButton(tr("Scan APB")); |
|
31 | this->scanBp = new QPushButton(tr("Scan APB")); | |
32 | this->deviceslst = new apbdevicelist; |
|
32 | this->deviceslst = new apbdevicelist; | |
33 | this->mainlayout->addWidget(this->deviceslst); |
|
33 | this->mainlayout->addWidget(this->deviceslst); | |
34 | this->mainlayout->addWidget(this->scanBp); |
|
34 | this->mainlayout->addWidget(this->scanBp); | |
35 | this->setLayout(this->mainlayout); |
|
35 | this->setLayout(this->mainlayout); | |
36 | this->_plugin = plugin; |
|
36 | this->_plugin = plugin; | |
37 | connect(this,SIGNAL(addAPBdevice(apbdeviceInfo*)),this->deviceslst,SLOT(addAPBdevice(apbdeviceInfo*))); |
|
37 | connect(this,SIGNAL(addAPBdevice(apbdeviceInfo*)),this->deviceslst,SLOT(addAPBdevice(apbdeviceInfo*))); | |
38 | connect(this,SIGNAL(clearAPBdevicesList()),this->deviceslst,SLOT(clearAPBdevicesList())); |
|
38 | connect(this,SIGNAL(clearAPBdevicesList()),this->deviceslst,SLOT(clearAPBdevicesList())); | |
39 | connect(this->scanBp,SIGNAL(clicked()),this,SLOT(scanAPB())); |
|
39 | connect(this->scanBp,SIGNAL(clicked()),this,SLOT(scanAPB())); | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void apbPluginUi::lockScanBp() |
|
42 | void apbPluginUi::lockScanBp() | |
43 | { |
|
43 | { | |
44 | this->scanBp->setEnabled(false); |
|
44 | this->scanBp->setEnabled(false); | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | void apbPluginUi::unlockScanBp() |
|
48 | void apbPluginUi::unlockScanBp() | |
49 | { |
|
49 | { | |
50 | this->scanBp->setEnabled(true); |
|
50 | this->scanBp->setEnabled(true); | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 |
|
53 | |||
54 |
|
54 | |||
55 | apbdeviceInfo* apbPluginUi::extractInfos(int *pnpregs) |
|
55 | apbdeviceInfo* apbPluginUi::extractInfos(int *pnpregs) | |
56 | { |
|
56 | { | |
57 | APBbarreg BAR[1]; |
|
57 | APBbarreg BAR[1]; | |
58 |
|
58 | |||
59 | int VID; |
|
59 | int VID; | |
60 | int PID; |
|
60 | int PID; | |
61 | for(int i=0;i<1;i++) |
|
61 | for(int i=0;i<1;i++) | |
62 | { |
|
62 | { | |
63 | BAR[i].address = ((uint32_t)(pnpregs[i+1] & 0xfff00000)>>12)+ APB_BUS_START; |
|
63 | BAR[i].address = ((uint32_t)(pnpregs[i+1] & 0xfff00000)>>12)+ APB_BUS_START; | |
64 | BAR[i].size = ((pnpregs[i+1] & 0x00000ff0)>>4 )+1; |
|
64 | BAR[i].size = ((pnpregs[i+1] & 0x00000ff0)>>4 )+1; | |
65 | BAR[i].type = (unsigned char)(pnpregs[i+1]&0xf); |
|
65 | BAR[i].type = (unsigned char)(pnpregs[i+1]&0xf); | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | VID = (pnpregs[0]>>24)&0xff; |
|
68 | VID = (pnpregs[0]>>24)&0xff; | |
69 | PID = (pnpregs[0]>>12)&0xfff; |
|
69 | PID = (pnpregs[0]>>12)&0xfff; | |
70 | QString devname = SocExplorerEngine::getDevName(VID,PID); |
|
70 | QString devname = SocExplorerEngine::getDevName(VID,PID); | |
71 | return new apbdeviceInfo(devname,BAR[0],VID,PID); |
|
71 | return new apbdeviceInfo(devname,BAR[0],VID,PID); | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | void apbPluginUi::scanAPB() |
|
74 | void apbPluginUi::scanAPB() | |
75 | { |
|
75 | { | |
76 | this->lockScanBp(); |
|
76 | this->lockScanBp(); | |
77 | unsigned int size = APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START; |
|
77 | unsigned int size = APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START; | |
78 | int j=0; |
|
78 | int j=0; | |
79 | unsigned long long i = APB_PLUGNPLAY_START; |
|
79 | unsigned long long i = APB_PLUGNPLAY_START; | |
80 | int pnpregs[APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START]; |
|
80 | int pnpregs[APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START]; | |
81 | emit this->clearAPBdevicesList(); |
|
81 | emit this->clearAPBdevicesList(); | |
82 | if(this->_plugin->Read((unsigned int*)pnpregs,size/4,(unsigned int)APB_PLUGNPLAY_START)==(size/4)) |
|
82 | if(this->_plugin->Read((unsigned int*)pnpregs,size/4,(unsigned int)APB_PLUGNPLAY_START)==(size/4)) | |
83 | { |
|
83 | { | |
84 | while(i<APB_PLUGNPLAY_STOP) |
|
84 | while(i<APB_PLUGNPLAY_STOP) | |
85 | { |
|
85 | { | |
86 | if(pnpregs[j]!=0) |
|
86 | if(pnpregs[j]!=0) | |
87 | { |
|
87 | { | |
88 | apbdeviceInfo* devinfos=this->extractInfos(pnpregs+j); |
|
88 | apbdeviceInfo* devinfos=this->extractInfos(pnpregs+j); | |
89 | SocExplorerEngine::addEnumDevice(this->_plugin,devinfos->VID,devinfos->PID,devinfos->BAR[0].address,devinfos->deviceName); |
|
89 | SocExplorerEngine::addEnumDevice(this->_plugin,devinfos->VID,devinfos->PID,devinfos->BAR[0].address,devinfos->deviceName); | |
90 | emit this->addAPBdevice(devinfos); |
|
90 | emit this->addAPBdevice(devinfos); | |
91 | } |
|
91 | } | |
92 | i+=8; |
|
92 | i+=8; | |
93 | j+=2; |
|
93 | j+=2; | |
94 | if(pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break; |
|
94 | if(pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break; | |
95 | } |
|
95 | } | |
96 | } |
|
96 | } | |
97 | this->unlockScanBp(); |
|
97 | this->unlockScanBp(); | |
98 | } |
|
98 | } | |
99 |
|
99 |
@@ -1,60 +1,60 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef APBPLUGINUI_H |
|
22 | #ifndef APBPLUGINUI_H | |
23 | #define APBPLUGINUI_H |
|
23 | #define APBPLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QHBoxLayout> |
|
26 | #include <QHBoxLayout> | |
27 | #include <QPushButton> |
|
27 | #include <QPushButton> | |
28 | #include "apbdevicelist.h" |
|
28 | #include "apbdevicelist.h" | |
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 |
|
30 | |||
31 | #define APB_BUS_START ((unsigned int)(0x80000000)) |
|
31 | #define APB_BUS_START ((unsigned int)(0x80000000)) | |
32 | #define APB_PLUGNPLAY_START ((unsigned int)(0x800FF000)) |
|
32 | #define APB_PLUGNPLAY_START ((unsigned int)(0x800FF000)) | |
33 |
|
33 | |||
34 | #define APB_PLUGNPLAY_STOP ((unsigned int)(0x800FF000+(512*8))) |
|
34 | #define APB_PLUGNPLAY_STOP ((unsigned int)(0x800FF000+(512*8))) | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | class apbPluginUi : public QWidget |
|
37 | class apbPluginUi : public QWidget | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | public: |
|
40 | public: | |
41 | explicit apbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0); |
|
41 | explicit apbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0); | |
42 | void lockScanBp(); |
|
42 | void lockScanBp(); | |
43 | void unlockScanBp(); |
|
43 | void unlockScanBp(); | |
44 | apbdeviceInfo* extractInfos(int* pnpregs); |
|
44 | apbdeviceInfo* extractInfos(int* pnpregs); | |
45 |
|
45 | |||
46 | signals: |
|
46 | signals: | |
47 | void addAPBdevice(apbdeviceInfo* device); |
|
47 | void addAPBdevice(apbdeviceInfo* device); | |
48 | void clearAPBdevicesList(); |
|
48 | void clearAPBdevicesList(); | |
49 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
49 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); | |
50 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
50 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); | |
51 | public slots: |
|
51 | public slots: | |
52 | void scanAPB(); |
|
52 | void scanAPB(); | |
53 | private: |
|
53 | private: | |
54 | QHBoxLayout* mainlayout; |
|
54 | QHBoxLayout* mainlayout; | |
55 | QPushButton* scanBp; |
|
55 | QPushButton* scanBp; | |
56 | apbdevicelist* deviceslst; |
|
56 | apbdevicelist* deviceslst; | |
57 | socexplorerplugin* _plugin; |
|
57 | socexplorerplugin* _plugin; | |
58 | }; |
|
58 | }; | |
59 |
|
59 | |||
60 | #endif // APBPLUGINUI_H |
|
60 | #endif // APBPLUGINUI_H |
@@ -1,92 +1,92 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2012, |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "ambaplugin.h" |
|
22 | #include "ambaplugin.h" | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | ambaplugin::ambaplugin(QWidget *parent):socexplorerplugin(parent,true) |
|
25 | ambaplugin::ambaplugin(QWidget *parent):socexplorerplugin(parent,true) | |
26 | { |
|
26 | { | |
27 | this->UI = new ambaPluginUI(this); |
|
27 | this->UI = new ambaPluginUI(this); | |
28 | this->setWidget((QWidget*)this->UI); |
|
28 | this->setWidget((QWidget*)this->UI); | |
29 | connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
29 | connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); | |
30 | connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); |
|
30 | connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); | |
31 | connect(this,SIGNAL(activateSig(bool)),this,SLOT(activatePlugin(bool))); |
|
31 | connect(this,SIGNAL(activateSig(bool)),this,SLOT(activatePlugin(bool))); | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 |
|
34 | |||
35 | ambaplugin::~ambaplugin() |
|
35 | ambaplugin::~ambaplugin() | |
36 | { |
|
36 | { | |
37 |
|
37 | |||
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | void ambaplugin::closeMe() |
|
41 | void ambaplugin::closeMe() | |
42 | { |
|
42 | { | |
43 | emit this->closePlugin(this); |
|
43 | emit this->closePlugin(this); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | void ambaplugin::postInstantiationTrigger() |
|
46 | void ambaplugin::postInstantiationTrigger() | |
47 | { |
|
47 | { | |
48 | if(this->parent->isConnected()) |
|
48 | if(this->parent->isConnected()) | |
49 | { |
|
49 | { | |
50 | this->UI->scanAll(); |
|
50 | this->UI->scanAll(); | |
51 | } |
|
51 | } | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | void ambaplugin::activatePlugin(bool flag) |
|
54 | void ambaplugin::activatePlugin(bool flag) | |
55 | { |
|
55 | { | |
56 | if(flag) |
|
56 | if(flag) | |
57 | { |
|
57 | { | |
58 | this->UI->scanAll(); |
|
58 | this->UI->scanAll(); | |
59 | } |
|
59 | } | |
60 | } |
|
60 | } | |
61 |
|
61 | |||
62 | int ambaplugin::registermenu(QMainWindow *menuHolder) |
|
62 | int ambaplugin::registermenu(QMainWindow *menuHolder) | |
63 | { |
|
63 | { | |
64 | this->menu = menuHolder->menuBar()->addMenu(tr("&ambaplugin")); |
|
64 | this->menu = menuHolder->menuBar()->addMenu(tr("&ambaplugin")); | |
65 | this->closeAction = this->menu->addAction(tr("Close plugin")); |
|
65 | this->closeAction = this->menu->addAction(tr("Close plugin")); | |
66 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); |
|
66 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); | |
67 | return 1; |
|
67 | return 1; | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
|
70 | |||
71 |
|
71 | |||
72 | unsigned int ambaplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
72 | unsigned int ambaplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
73 | { |
|
73 | { | |
74 | if(parent!=NULL) |
|
74 | if(parent!=NULL) | |
75 | return parent->Read(Value,count,address); |
|
75 | return parent->Read(Value,count,address); | |
76 | return 0; |
|
76 | return 0; | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | unsigned int ambaplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) |
|
79 | unsigned int ambaplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) | |
80 | { |
|
80 | { | |
81 | if(parent!=NULL) |
|
81 | if(parent!=NULL) | |
82 | return parent->Write(Value,count,address); |
|
82 | return parent->Write(Value,count,address); | |
83 | return 0; |
|
83 | return 0; | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 |
|
86 | |||
87 |
|
87 | |||
88 |
|
88 | |||
89 |
|
89 | |||
90 |
|
90 | |||
91 |
|
91 | |||
92 |
|
92 |
@@ -1,56 +1,56 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2012, |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef ambaplugin_H |
|
22 | #ifndef ambaplugin_H | |
23 | #define ambaplugin_H |
|
23 | #define ambaplugin_H | |
24 | #include <QMenuBar> |
|
24 | #include <QMenuBar> | |
25 | #include <QMenu> |
|
25 | #include <QMenu> | |
26 | #include <QAction> |
|
26 | #include <QAction> | |
27 | #include <QLayout> |
|
27 | #include <QLayout> | |
28 | #include "ambapluginui.h" |
|
28 | #include "ambapluginui.h" | |
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 |
|
30 | |||
31 |
|
31 | |||
32 |
|
32 | |||
33 | class ambaplugin : public socexplorerplugin |
|
33 | class ambaplugin : public socexplorerplugin | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 | explicit ambaplugin(QWidget *parent = 0); |
|
37 | explicit ambaplugin(QWidget *parent = 0); | |
38 | ~ambaplugin(); |
|
38 | ~ambaplugin(); | |
39 | int registermenu(QMainWindow *menuHolder); |
|
39 | int registermenu(QMainWindow *menuHolder); | |
40 | int VID(){return driver_VID;} |
|
40 | int VID(){return driver_VID;} | |
41 | int PID(){return driver_PID;} |
|
41 | int PID(){return driver_PID;} | |
42 |
|
42 | |||
43 | public slots: |
|
43 | public slots: | |
44 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
44 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); | |
45 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
45 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
46 | void closeMe(); |
|
46 | void closeMe(); | |
47 | void postInstantiationTrigger(); |
|
47 | void postInstantiationTrigger(); | |
48 | void activatePlugin(bool flag); |
|
48 | void activatePlugin(bool flag); | |
49 | signals: |
|
49 | signals: | |
50 |
|
50 | |||
51 | private: |
|
51 | private: | |
52 | ambaPluginUI* UI; |
|
52 | ambaPluginUI* UI; | |
53 | }; |
|
53 | }; | |
54 |
|
54 | |||
55 | #endif // ambaplugin_H |
|
55 | #endif // ambaplugin_H | |
56 |
|
56 |
@@ -1,43 +1,43 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2012, |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "ambapluginui.h" |
|
22 | #include "ambapluginui.h" | |
23 |
|
23 | |||
24 | ambaPluginUI::ambaPluginUI(socexplorerplugin *plugin, QWidget *parent) : |
|
24 | ambaPluginUI::ambaPluginUI(socexplorerplugin *plugin, QWidget *parent) : | |
25 | QWidget(parent) |
|
25 | QWidget(parent) | |
26 | { |
|
26 | { | |
27 | this->mainLayout=new QGridLayout(); |
|
27 | this->mainLayout=new QGridLayout(); | |
28 | this->ahbPlugin=new ahbPluginUi(plugin); |
|
28 | this->ahbPlugin=new ahbPluginUi(plugin); | |
29 | this->apbPlugin=new apbPluginUi(plugin); |
|
29 | this->apbPlugin=new apbPluginUi(plugin); | |
30 | this->mainLayout->addWidget(this->ahbPlugin,0,0,1,-1); |
|
30 | this->mainLayout->addWidget(this->ahbPlugin,0,0,1,-1); | |
31 | this->mainLayout->addWidget(this->apbPlugin,1,0,1,-1); |
|
31 | this->mainLayout->addWidget(this->apbPlugin,1,0,1,-1); | |
32 | this->setLayout(this->mainLayout); |
|
32 | this->setLayout(this->mainLayout); | |
33 | connect(this->ahbPlugin,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); |
|
33 | connect(this->ahbPlugin,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); | |
34 | connect(this->ahbPlugin,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); |
|
34 | connect(this->ahbPlugin,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); | |
35 | connect(this->apbPlugin,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); |
|
35 | connect(this->apbPlugin,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); | |
36 | connect(this->apbPlugin,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); |
|
36 | connect(this->apbPlugin,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void ambaPluginUI::scanAll() |
|
39 | void ambaPluginUI::scanAll() | |
40 | { |
|
40 | { | |
41 | this->ahbPlugin->scanAHB(); |
|
41 | this->ahbPlugin->scanAHB(); | |
42 | this->apbPlugin->scanAPB(); |
|
42 | this->apbPlugin->scanAPB(); | |
43 | } |
|
43 | } |
@@ -1,49 +1,49 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2012, |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef AMBAPLUGINUI_H |
|
22 | #ifndef AMBAPLUGINUI_H | |
23 | #define AMBAPLUGINUI_H |
|
23 | #define AMBAPLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QVBoxLayout> |
|
26 | #include <QVBoxLayout> | |
27 | #include <QGridLayout> |
|
27 | #include <QGridLayout> | |
28 | #include <QPushButton> |
|
28 | #include <QPushButton> | |
29 | #include "AHB/ahbpluginui.h" |
|
29 | #include "AHB/ahbpluginui.h" | |
30 | #include "APB/apbpluginui.h" |
|
30 | #include "APB/apbpluginui.h" | |
31 |
|
31 | |||
32 | class ambaPluginUI : public QWidget |
|
32 | class ambaPluginUI : public QWidget | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 | explicit ambaPluginUI(socexplorerplugin* plugin,QWidget *parent = 0); |
|
36 | explicit ambaPluginUI(socexplorerplugin* plugin,QWidget *parent = 0); | |
37 |
|
37 | |||
38 | signals: |
|
38 | signals: | |
39 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
39 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); | |
40 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
40 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); | |
41 | public slots: |
|
41 | public slots: | |
42 | void scanAll(); |
|
42 | void scanAll(); | |
43 | private: |
|
43 | private: | |
44 | QGridLayout* mainLayout; |
|
44 | QGridLayout* mainLayout; | |
45 | ahbPluginUi* ahbPlugin; |
|
45 | ahbPluginUi* ahbPlugin; | |
46 | apbPluginUi* apbPlugin; |
|
46 | apbPluginUi* apbPlugin; | |
47 | }; |
|
47 | }; | |
48 |
|
48 | |||
49 | #endif // AMBAPLUGINUI_H |
|
49 | #endif // AMBAPLUGINUI_H |
@@ -1,225 +1,225 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "dsu3plugin.h" |
|
22 | #include "dsu3plugin.h" | |
23 | #include <QFileDialog> |
|
23 | #include <QFileDialog> | |
24 | #include <QDir> |
|
24 | #include <QDir> | |
25 | #include "dsu3pluginpywrapper.h" |
|
25 | #include "dsu3pluginpywrapper.h" | |
26 | #include <socexplorerengine.h> |
|
26 | #include <socexplorerengine.h> | |
27 |
|
27 | |||
28 | dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false) |
|
28 | dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false) | |
29 | { |
|
29 | { | |
30 | this->UI = new dsu3pluginui(); |
|
30 | this->UI = new dsu3pluginui(); | |
31 | this->setWidget((QWidget*)this->UI); |
|
31 | this->setWidget((QWidget*)this->UI); | |
32 | this->elfparserInst = new elfparser(); |
|
32 | this->elfparserInst = new elfparser(); | |
33 | this->pyObject = new dsu3pluginPywrapper(this); |
|
33 | this->pyObject = new dsu3pluginPywrapper(this); | |
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 | connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile())); |
|
37 | connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile())); | |
38 | connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget())); |
|
38 | connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget())); | |
39 | connect(this->UI,SIGNAL(run()),this,SLOT(run())); |
|
39 | connect(this->UI,SIGNAL(run()),this,SLOT(run())); | |
40 | connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*))); |
|
40 | connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*))); | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | dsu3plugin::~dsu3plugin() |
|
44 | dsu3plugin::~dsu3plugin() | |
45 | { |
|
45 | { | |
46 |
|
46 | |||
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | void dsu3plugin::openFile() |
|
50 | void dsu3plugin::openFile() | |
51 | { |
|
51 | { | |
52 | QString filename = QFileDialog::getOpenFileName(this,tr("Open elf File"), QDir::homePath(), tr("Elf Files (*)")); |
|
52 | QString filename = QFileDialog::getOpenFileName(this,tr("Open elf File"), QDir::homePath(), tr("Elf Files (*)")); | |
53 | if(filename!="") |
|
53 | if(filename!="") | |
54 | { |
|
54 | { | |
55 | this->openFile(filename); |
|
55 | this->openFile(filename); | |
56 | } |
|
56 | } | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | void dsu3plugin::openFile(QString fileName) |
|
59 | void dsu3plugin::openFile(QString fileName) | |
60 | { |
|
60 | { | |
61 | this->elfparserInst->setFilename(fileName); |
|
61 | this->elfparserInst->setFilename(fileName); | |
62 | emit this->updateInfo(this->elfparserInst); |
|
62 | emit this->updateInfo(this->elfparserInst); | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | bool dsu3plugin::configureTarget() |
|
65 | bool dsu3plugin::configureTarget() | |
66 | { |
|
66 | { | |
67 | if(parent==NULL) |
|
67 | if(parent==NULL) | |
68 | return false; |
|
68 | return false; | |
69 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
|
69 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); | |
70 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
70 | if(DSUBASEADDRESS == (unsigned int)-1) | |
71 | DSUBASEADDRESS = 0x90000000; |
|
71 | DSUBASEADDRESS = 0x90000000; | |
72 | unsigned int MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x04 , 0x00F,0); |
|
72 | unsigned int MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x04 , 0x00F,0); | |
73 | if(MCTRLBASEADDRESS == (unsigned int)-1) |
|
73 | if(MCTRLBASEADDRESS == (unsigned int)-1) | |
74 | return false; |
|
74 | return false; | |
75 |
|
75 | |||
76 | //Force a debug break |
|
76 | //Force a debug break | |
77 | WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS); |
|
77 | WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS); | |
78 | WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20); |
|
78 | WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20); | |
79 | //Clear time tag counter |
|
79 | //Clear time tag counter | |
80 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8); |
|
80 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8); | |
81 |
|
81 | |||
82 | //Clear ASR registers |
|
82 | //Clear ASR registers | |
83 | WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040); |
|
83 | WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040); | |
84 | WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024); |
|
84 | WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024); | |
85 | WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); |
|
85 | WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); | |
86 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48); |
|
86 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48); | |
87 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C); |
|
87 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C); | |
88 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040); |
|
88 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040); | |
89 |
|
89 | |||
90 |
|
90 | |||
91 |
|
91 | |||
92 | WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS); |
|
92 | WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS); | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); |
|
95 | WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); | |
96 | WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24); |
|
96 | WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24); | |
97 |
|
97 | |||
98 | unsigned int buff=0; |
|
98 | unsigned int buff=0; | |
99 | // for(int i=0;i<1567;i++) |
|
99 | // for(int i=0;i<1567;i++) | |
100 | // { |
|
100 | // { | |
101 | // parent->Write(&buff,(unsigned int)1,DSUBASEADDRESS+0x300000+(4*i)); |
|
101 | // parent->Write(&buff,(unsigned int)1,DSUBASEADDRESS+0x300000+(4*i)); | |
102 | // } |
|
102 | // } | |
103 | memSet(DSUBASEADDRESS+0x300000,0,1567); |
|
103 | memSet(DSUBASEADDRESS+0x300000,0,1567); | |
104 | WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000); |
|
104 | WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000); | |
105 | WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0x403ffff0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x300020); |
|
105 | WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0x403ffff0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x300020); | |
106 | WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS); |
|
106 | WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS); | |
107 |
|
107 | |||
108 | //Disable interrupts |
|
108 | //Disable interrupts | |
109 | unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0); |
|
109 | unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0); | |
110 | if(APBIRQCTRLRBASEADD == (unsigned int)-1) |
|
110 | if(APBIRQCTRLRBASEADD == (unsigned int)-1) | |
111 | return false; |
|
111 | return false; | |
112 | WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040); |
|
112 | WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040); | |
113 | WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080); |
|
113 | WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080); | |
114 | WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD); |
|
114 | WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD); | |
115 |
|
115 | |||
116 | //Set up timer |
|
116 | //Set up timer | |
117 | unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0); |
|
117 | unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0); | |
118 | if(APBTIMERBASEADD == (unsigned int)-1) |
|
118 | if(APBTIMERBASEADD == (unsigned int)-1) | |
119 | return false; |
|
119 | return false; | |
120 | WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014); |
|
120 | WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014); | |
121 | WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04); |
|
121 | WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04); | |
122 | WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018); |
|
122 | WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018); | |
123 | return true; |
|
123 | return true; | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | bool dsu3plugin::flashTarget() |
|
126 | bool dsu3plugin::flashTarget() | |
127 | { |
|
127 | { | |
128 | configureTarget(); |
|
128 | configureTarget(); | |
129 |
|
129 | |||
130 | /*Write .text*/ |
|
130 | /*Write .text*/ | |
131 | this->writeSection(".text"); |
|
131 | this->writeSection(".text"); | |
132 | /*Write .data*/ |
|
132 | /*Write .data*/ | |
133 | this->writeSection(".data"); |
|
133 | this->writeSection(".data"); | |
134 | return true; |
|
134 | return true; | |
135 | } |
|
135 | } | |
136 |
|
136 | |||
137 | void dsu3plugin::run() |
|
137 | void dsu3plugin::run() | |
138 | { |
|
138 | { | |
139 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
|
139 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); | |
140 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
140 | if(DSUBASEADDRESS == (unsigned int)-1) | |
141 | DSUBASEADDRESS = 0x90000000; |
|
141 | DSUBASEADDRESS = 0x90000000; | |
142 | WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020); |
|
142 | WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020); | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 | void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address) |
|
145 | void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address) | |
146 | { |
|
146 | { | |
147 | unsigned int* buff; |
|
147 | unsigned int* buff; | |
148 | buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int)); |
|
148 | buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int)); | |
149 | for(int i=0;i<Values.count();i++) |
|
149 | for(int i=0;i<Values.count();i++) | |
150 | { |
|
150 | { | |
151 | buff[i]=Values.at(i); |
|
151 | buff[i]=Values.at(i); | |
152 | } |
|
152 | } | |
153 | parent->Write(buff,(unsigned int)Values.count(),address); |
|
153 | parent->Write(buff,(unsigned int)Values.count(),address); | |
154 | free(buff); |
|
154 | free(buff); | |
155 | } |
|
155 | } | |
156 |
|
156 | |||
157 | void dsu3plugin::writeSection(int index) |
|
157 | void dsu3plugin::writeSection(int index) | |
158 | { |
|
158 | { | |
159 | char* buffch=NULL; |
|
159 | char* buffch=NULL; | |
160 | unsigned int* buff; |
|
160 | unsigned int* buff; | |
161 | int size = this->elfparserInst->getSectionDatasz(index); |
|
161 | int size = this->elfparserInst->getSectionDatasz(index); | |
162 | int sizeInt = size/4; |
|
162 | int sizeInt = size/4; | |
163 | if(parent==NULL) |
|
163 | if(parent==NULL) | |
164 | return; |
|
164 | return; | |
165 | this->elfparserInst->getSectionData(index,&buffch); |
|
165 | this->elfparserInst->getSectionData(index,&buffch); | |
166 | buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int)); |
|
166 | buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int)); | |
167 | for(int i=0;i<sizeInt;i++) |
|
167 | for(int i=0;i<sizeInt;i++) | |
168 | { |
|
168 | { | |
169 | buff[i] = 0x0FF & ((unsigned int)buffch[4*i]); |
|
169 | buff[i] = 0x0FF & ((unsigned int)buffch[4*i]); | |
170 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1])); |
|
170 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1])); | |
171 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2])); |
|
171 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2])); | |
172 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3])); |
|
172 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3])); | |
173 | } |
|
173 | } | |
174 | if(size%4) |
|
174 | if(size%4) | |
175 | { |
|
175 | { | |
176 | buff[sizeInt]=0; |
|
176 | buff[sizeInt]=0; | |
177 | for(int i=(size%4);i>0;i--) |
|
177 | for(int i=(size%4);i>0;i--) | |
178 | { |
|
178 | { | |
179 | buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i])); |
|
179 | buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i])); | |
180 | } |
|
180 | } | |
181 | sizeInt++; |
|
181 | sizeInt++; | |
182 | } |
|
182 | } | |
183 | parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index)); |
|
183 | parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index)); | |
184 | free(buff); |
|
184 | free(buff); | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | void dsu3plugin::writeSection(const QString &name) |
|
187 | void dsu3plugin::writeSection(const QString &name) | |
188 | { |
|
188 | { | |
189 | for(int i=0;i<this->elfparserInst->getSectioncount();i++) |
|
189 | for(int i=0;i<this->elfparserInst->getSectioncount();i++) | |
190 | { |
|
190 | { | |
191 | if(!this->elfparserInst->getSectionName(i).compare(name)) |
|
191 | if(!this->elfparserInst->getSectionName(i).compare(name)) | |
192 | { |
|
192 | { | |
193 | printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i)); |
|
193 | printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i)); | |
194 | writeSection(i); |
|
194 | writeSection(i); | |
195 | } |
|
195 | } | |
196 | } |
|
196 | } | |
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 |
|
199 | |||
200 | unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address) |
|
200 | unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address) | |
201 | { |
|
201 | { | |
202 | if(parent!=NULL) |
|
202 | if(parent!=NULL) | |
203 | return parent->Write(Value,count,address); |
|
203 | return parent->Write(Value,count,address); | |
204 | return 0; |
|
204 | return 0; | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count) |
|
207 | bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count) | |
208 | { |
|
208 | { | |
209 | unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int)); |
|
209 | unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int)); | |
210 | if(buffer!=NULL) |
|
210 | if(buffer!=NULL) | |
211 | { |
|
211 | { | |
212 | memset((void*)buffer,value,count*sizeof(unsigned int)); |
|
212 | memset((void*)buffer,value,count*sizeof(unsigned int)); | |
213 | parent->Write(buffer,count,address); |
|
213 | parent->Write(buffer,count,address); | |
214 | free(buffer ); |
|
214 | free(buffer ); | |
215 | return true; |
|
215 | return true; | |
216 | } |
|
216 | } | |
217 | return false; |
|
217 | return false; | |
218 | } |
|
218 | } | |
219 |
|
219 | |||
220 | unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address) |
|
220 | unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address) | |
221 | { |
|
221 | { | |
222 | if(parent!=NULL) |
|
222 | if(parent!=NULL) | |
223 | return parent->Read(Value,count,address); |
|
223 | return parent->Read(Value,count,address); | |
224 | return 0; |
|
224 | return 0; | |
225 | } |
|
225 | } |
@@ -1,61 +1,61 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2012, |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef DSU3PLUGIN_H |
|
22 | #ifndef DSU3PLUGIN_H | |
23 | #define DSU3PLUGIN_H |
|
23 | #define DSU3PLUGIN_H | |
24 | #include "dsu3pluginui.h" |
|
24 | #include "dsu3pluginui.h" | |
25 | #include <QMenuBar> |
|
25 | #include <QMenuBar> | |
26 | #include <QMenu> |
|
26 | #include <QMenu> | |
27 | #include <QAction> |
|
27 | #include <QAction> | |
28 | #include <QMainWindow> |
|
28 | #include <QMainWindow> | |
29 | #include <QList> |
|
29 | #include <QList> | |
30 | #include "elfparser.h" |
|
30 | #include "elfparser.h" | |
31 | #include <socexplorerplugin.h> |
|
31 | #include <socexplorerplugin.h> | |
32 | #include <socexplorerengine.h> |
|
32 | #include <socexplorerengine.h> | |
33 |
|
33 | |||
34 | typedef QList<unsigned int> uIntlist; |
|
34 | typedef QList<unsigned int> uIntlist; | |
35 |
|
35 | |||
36 | class dsu3plugin : public socexplorerplugin |
|
36 | class dsu3plugin : public socexplorerplugin | |
37 | { |
|
37 | { | |
38 | Q_OBJECT |
|
38 | Q_OBJECT | |
39 | public: |
|
39 | public: | |
40 | explicit dsu3plugin(QWidget *parent = 0); |
|
40 | explicit dsu3plugin(QWidget *parent = 0); | |
41 | ~dsu3plugin(); |
|
41 | ~dsu3plugin(); | |
42 | bool memSet(unsigned int address, int value, unsigned int count); |
|
42 | bool memSet(unsigned int address, int value, unsigned int count); | |
43 | public slots: |
|
43 | public slots: | |
44 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
44 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
45 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
45 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
46 | void openFile(); |
|
46 | void openFile(); | |
47 | void openFile(QString fileName); |
|
47 | void openFile(QString fileName); | |
48 | bool configureTarget(); |
|
48 | bool configureTarget(); | |
49 | bool flashTarget(); |
|
49 | bool flashTarget(); | |
50 | void run(); |
|
50 | void run(); | |
51 | signals: |
|
51 | signals: | |
52 | void updateInfo(elfparser* parser); |
|
52 | void updateInfo(elfparser* parser); | |
53 | private: |
|
53 | private: | |
54 | void WriteRegs(uIntlist Values, unsigned int address); |
|
54 | void WriteRegs(uIntlist Values, unsigned int address); | |
55 | void writeSection(int index); |
|
55 | void writeSection(int index); | |
56 | void writeSection(const QString& name); |
|
56 | void writeSection(const QString& name); | |
57 | dsu3pluginui* UI; |
|
57 | dsu3pluginui* UI; | |
58 | elfparser* elfparserInst; |
|
58 | elfparser* elfparserInst; | |
59 | }; |
|
59 | }; | |
60 |
|
60 | |||
61 | #endif // DSU3PLUGIN_H |
|
61 | #endif // DSU3PLUGIN_H |
@@ -1,54 +1,54 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2013, |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #include <dsu3pluginui.h> |
|
23 | #include <dsu3pluginui.h> | |
24 |
|
24 | |||
25 | dsu3pluginui::dsu3pluginui(QWidget *parent) |
|
25 | dsu3pluginui::dsu3pluginui(QWidget *parent) | |
26 | :QWidget(parent) |
|
26 | :QWidget(parent) | |
27 | { |
|
27 | { | |
28 | this->openFileQpb = new QPushButton(tr("Open File")); |
|
28 | this->openFileQpb = new QPushButton(tr("Open File")); | |
29 | this->flashTargetQpb = new QPushButton(tr("Flash Target")); |
|
29 | this->flashTargetQpb = new QPushButton(tr("Flash Target")); | |
30 | this->runQpb = new QPushButton(tr("Run")); |
|
30 | this->runQpb = new QPushButton(tr("Run")); | |
31 | this->mainLayout = new QGridLayout(); |
|
31 | this->mainLayout = new QGridLayout(); | |
32 | this->elfInfoWdgtInst = new elfInfoWdgt; |
|
32 | this->elfInfoWdgtInst = new elfInfoWdgt; | |
33 | this->mainLayout->addWidget(this->openFileQpb,0,0,1,1); |
|
33 | this->mainLayout->addWidget(this->openFileQpb,0,0,1,1); | |
34 | this->mainLayout->addWidget(this->flashTargetQpb,0,1,1,1); |
|
34 | this->mainLayout->addWidget(this->flashTargetQpb,0,1,1,1); | |
35 | this->mainLayout->addWidget(this->runQpb,0,2,1,1); |
|
35 | this->mainLayout->addWidget(this->runQpb,0,2,1,1); | |
36 | this->mainLayout->addWidget(this->elfInfoWdgtInst,1,0,1,-1); |
|
36 | this->mainLayout->addWidget(this->elfInfoWdgtInst,1,0,1,-1); | |
37 | this->setLayout(this->mainLayout); |
|
37 | this->setLayout(this->mainLayout); | |
38 | connect(this->openFileQpb,SIGNAL(clicked()),this,SIGNAL(openFile())); |
|
38 | connect(this->openFileQpb,SIGNAL(clicked()),this,SIGNAL(openFile())); | |
39 | connect(this->flashTargetQpb,SIGNAL(clicked()),this,SIGNAL(flashTarget())); |
|
39 | connect(this->flashTargetQpb,SIGNAL(clicked()),this,SIGNAL(flashTarget())); | |
40 | connect(this->runQpb,SIGNAL(clicked()),this,SIGNAL(run())); |
|
40 | connect(this->runQpb,SIGNAL(clicked()),this,SIGNAL(run())); | |
41 | connect(this,SIGNAL(updateInfo(elfparser*)),this->elfInfoWdgtInst,SLOT(updateInfo(elfparser*))); |
|
41 | connect(this,SIGNAL(updateInfo(elfparser*)),this->elfInfoWdgtInst,SLOT(updateInfo(elfparser*))); | |
42 |
|
42 | |||
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 |
|
45 | |||
46 |
|
46 | |||
47 |
|
47 | |||
48 |
|
48 | |||
49 |
|
49 | |||
50 |
|
50 | |||
51 |
|
51 | |||
52 |
|
52 | |||
53 |
|
53 | |||
54 |
|
54 |
@@ -1,58 +1,58 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2012, |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef DSU3PLUGINUI_H |
|
22 | #ifndef DSU3PLUGINUI_H | |
23 | #define DSU3PLUGINUI_H |
|
23 | #define DSU3PLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QHBoxLayout> |
|
26 | #include <QHBoxLayout> | |
27 | #include <QPushButton> |
|
27 | #include <QPushButton> | |
28 | #include <qhexedit.h> |
|
28 | #include <qhexedit.h> | |
29 | #include <QSplitter> |
|
29 | #include <QSplitter> | |
30 | #include <QVBoxLayout> |
|
30 | #include <QVBoxLayout> | |
31 | #include <QGridLayout> |
|
31 | #include <QGridLayout> | |
32 | #include "elfinfowdgt.h" |
|
32 | #include "elfinfowdgt.h" | |
33 |
|
33 | |||
34 | class dsu3pluginui : public QWidget |
|
34 | class dsu3pluginui : public QWidget | |
35 | { |
|
35 | { | |
36 | Q_OBJECT |
|
36 | Q_OBJECT | |
37 | public: |
|
37 | public: | |
38 | explicit dsu3pluginui(QWidget *parent = 0); |
|
38 | explicit dsu3pluginui(QWidget *parent = 0); | |
39 |
|
39 | |||
40 | public slots: |
|
40 | public slots: | |
41 |
|
41 | |||
42 | signals: |
|
42 | signals: | |
43 | void openFile(); |
|
43 | void openFile(); | |
44 | void updateInfo(elfparser* parser); |
|
44 | void updateInfo(elfparser* parser); | |
45 | bool flashTarget(); |
|
45 | bool flashTarget(); | |
46 | void run(); |
|
46 | void run(); | |
47 | private: |
|
47 | private: | |
48 | QGridLayout* mainLayout; |
|
48 | QGridLayout* mainLayout; | |
49 | QPushButton* openFileQpb; |
|
49 | QPushButton* openFileQpb; | |
50 | QPushButton* flashTargetQpb; |
|
50 | QPushButton* flashTargetQpb; | |
51 | QPushButton* runQpb; |
|
51 | QPushButton* runQpb; | |
52 | elfInfoWdgt* elfInfoWdgtInst; |
|
52 | elfInfoWdgt* elfInfoWdgtInst; | |
53 |
|
53 | |||
54 | }; |
|
54 | }; | |
55 |
|
55 | |||
56 | #endif // DSU3PLUGINUI_H |
|
56 | #endif // DSU3PLUGINUI_H | |
57 |
|
57 | |||
58 |
|
58 |
@@ -1,61 +1,61 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "genericrwplugin.h" |
|
22 | #include "genericrwplugin.h" | |
23 | #include "genericrwpluginpywrapper.h" |
|
23 | #include "genericrwpluginpywrapper.h" | |
24 | genericrwplugin::genericrwplugin(QWidget *parent):socexplorerplugin(parent,false) |
|
24 | genericrwplugin::genericrwplugin(QWidget *parent):socexplorerplugin(parent,false) | |
25 | { |
|
25 | { | |
26 | this->UI = new genericrwpluginUi(); |
|
26 | this->UI = new genericrwpluginUi(); | |
27 | this->setWidget((QWidget*)this->UI); |
|
27 | this->setWidget((QWidget*)this->UI); | |
28 | connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
28 | connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); | |
29 | connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); |
|
29 | connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); | |
30 | this->pyObject = new genericRWpluginPyWrapper(this); |
|
30 | this->pyObject = new genericRWpluginPyWrapper(this); | |
31 | //QObject::connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
31 | //QObject::connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); | |
32 | //QObject::connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); |
|
32 | //QObject::connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); | |
33 | QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(refresh()),this->UI,SIGNAL(refresh())); |
|
33 | QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(refresh()),this->UI,SIGNAL(refresh())); | |
34 | QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setAddress(quint32)),this->UI,SIGNAL(setAddress(quint32))); |
|
34 | QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setAddress(quint32)),this->UI,SIGNAL(setAddress(quint32))); | |
35 | QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setLength(quint32)),this->UI,SIGNAL(setLength(quint32))); |
|
35 | QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setLength(quint32)),this->UI,SIGNAL(setLength(quint32))); | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | genericrwplugin::~genericrwplugin() |
|
38 | genericrwplugin::~genericrwplugin() | |
39 | {} |
|
39 | {} | |
40 |
|
40 | |||
41 | int genericrwplugin::registermenu(QMainWindow *menuHolder) |
|
41 | int genericrwplugin::registermenu(QMainWindow *menuHolder) | |
42 | { |
|
42 | { | |
43 | this->menu = menuHolder->menuBar()->addMenu(tr("&Generic RW Driver")); |
|
43 | this->menu = menuHolder->menuBar()->addMenu(tr("&Generic RW Driver")); | |
44 | this->closeAction = this->menu->addAction(tr("Close plugin")); |
|
44 | this->closeAction = this->menu->addAction(tr("Close plugin")); | |
45 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); |
|
45 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); | |
46 | return 1; |
|
46 | return 1; | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | unsigned int genericrwplugin::Write(unsigned int *Value,unsigned int count,unsigned int address) |
|
49 | unsigned int genericrwplugin::Write(unsigned int *Value,unsigned int count,unsigned int address) | |
50 | { |
|
50 | { | |
51 | if(parent!=NULL) |
|
51 | if(parent!=NULL) | |
52 | return parent->Write(Value,count,address); |
|
52 | return parent->Write(Value,count,address); | |
53 | return 0; |
|
53 | return 0; | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | unsigned int genericrwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
56 | unsigned int genericrwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
57 | { |
|
57 | { | |
58 | if(parent!=NULL) |
|
58 | if(parent!=NULL) | |
59 | return parent->Read(Value,count,address); |
|
59 | return parent->Read(Value,count,address); | |
60 | return 0; |
|
60 | return 0; | |
61 | } |
|
61 | } |
@@ -1,56 +1,56 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef GENERICRWPLUGIN_H |
|
22 | #ifndef GENERICRWPLUGIN_H | |
23 | #define GENERICRWPLUGIN_H |
|
23 | #define GENERICRWPLUGIN_H | |
24 | #include "genericrwpluginui.h" |
|
24 | #include "genericrwpluginui.h" | |
25 | #include <QMenuBar> |
|
25 | #include <QMenuBar> | |
26 | #include <QMenu> |
|
26 | #include <QMenu> | |
27 | #include <QAction> |
|
27 | #include <QAction> | |
28 | #include <QMainWindow> |
|
28 | #include <QMainWindow> | |
29 |
|
29 | |||
30 |
|
30 | |||
31 |
|
31 | |||
32 | #include <socexplorerplugin.h> |
|
32 | #include <socexplorerplugin.h> | |
33 |
|
33 | |||
34 | #define AHB_PLUGNPLAY_MASTER_START 0xFFFFF000 |
|
34 | #define AHB_PLUGNPLAY_MASTER_START 0xFFFFF000 | |
35 | #define AHB_PLUGNPLAY_MASTER_STOP 0xFFFFF800 |
|
35 | #define AHB_PLUGNPLAY_MASTER_STOP 0xFFFFF800 | |
36 | #define AHB_PLUGNPLAY_SLAVE_START 0xFFFFF800 |
|
36 | #define AHB_PLUGNPLAY_SLAVE_START 0xFFFFF800 | |
37 | #define AHB_PLUGNPLAY_SLAVE_STOP 0xFFFFFFFC |
|
37 | #define AHB_PLUGNPLAY_SLAVE_STOP 0xFFFFFFFC | |
38 |
|
38 | |||
39 |
|
39 | |||
40 | class genericrwplugin : public socexplorerplugin |
|
40 | class genericrwplugin : public socexplorerplugin | |
41 | { |
|
41 | { | |
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 | public: |
|
43 | public: | |
44 | explicit genericrwplugin(QWidget *parent = 0); |
|
44 | explicit genericrwplugin(QWidget *parent = 0); | |
45 | ~genericrwplugin(); |
|
45 | ~genericrwplugin(); | |
46 | int registermenu(QMainWindow *menuHolder); |
|
46 | int registermenu(QMainWindow *menuHolder); | |
47 | public slots: |
|
47 | public slots: | |
48 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
48 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
49 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
49 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
50 | signals: |
|
50 | signals: | |
51 |
|
51 | |||
52 | private: |
|
52 | private: | |
53 | genericrwpluginUi* UI; |
|
53 | genericrwpluginUi* UI; | |
54 | }; |
|
54 | }; | |
55 |
|
55 | |||
56 | #endif // GENERICRWPLUGIN_H |
|
56 | #endif // GENERICRWPLUGIN_H |
@@ -1,27 +1,27 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "genericrwpluginpywrapper.h" |
|
22 | #include "genericrwpluginpywrapper.h" | |
23 |
|
23 | |||
24 | genericRWpluginPyWrapper::genericRWpluginPyWrapper(socexplorerplugin *parent) : |
|
24 | genericRWpluginPyWrapper::genericRWpluginPyWrapper(socexplorerplugin *parent) : | |
25 | genericPySysdriver(parent) |
|
25 | genericPySysdriver(parent) | |
26 | { |
|
26 | { | |
27 | } |
|
27 | } |
@@ -1,40 +1,40 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef GENERICRWPLUGINPYWRAPPER_H |
|
22 | #ifndef GENERICRWPLUGINPYWRAPPER_H | |
23 | #define GENERICRWPLUGINPYWRAPPER_H |
|
23 | #define GENERICRWPLUGINPYWRAPPER_H | |
24 | #include <genericPySysdriver.h> |
|
24 | #include <genericPySysdriver.h> | |
25 | class genericRWpluginPyWrapper : public genericPySysdriver |
|
25 | class genericRWpluginPyWrapper : public genericPySysdriver | |
26 | { |
|
26 | { | |
27 | Q_OBJECT |
|
27 | Q_OBJECT | |
28 | public: |
|
28 | public: | |
29 | explicit genericRWpluginPyWrapper(socexplorerplugin *parent = 0); |
|
29 | explicit genericRWpluginPyWrapper(socexplorerplugin *parent = 0); | |
30 |
|
30 | |||
31 | signals: |
|
31 | signals: | |
32 | void refresh(); |
|
32 | void refresh(); | |
33 | void setAddress(quint32 address); |
|
33 | void setAddress(quint32 address); | |
34 | void setLength(quint32 length); |
|
34 | void setLength(quint32 length); | |
35 |
|
35 | |||
36 | public slots: |
|
36 | public slots: | |
37 |
|
37 | |||
38 | }; |
|
38 | }; | |
39 |
|
39 | |||
40 | #endif // GENERICRWPLUGINPYWRAPPER_H |
|
40 | #endif // GENERICRWPLUGINPYWRAPPER_H |
@@ -1,41 +1,41 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "genericrwplugin.h" |
|
22 | #include "genericrwplugin.h" | |
23 |
|
23 | |||
24 | genericrwpluginUi::genericrwpluginUi(QWidget *parent) : |
|
24 | genericrwpluginUi::genericrwpluginUi(QWidget *parent) : | |
25 | QWidget(parent) |
|
25 | QWidget(parent) | |
26 | { |
|
26 | { | |
27 |
|
27 | |||
28 | this->mainlayout = new QHBoxLayout; |
|
28 | this->mainlayout = new QHBoxLayout; | |
29 | this->tabWdgt = new QTabWidget; |
|
29 | this->tabWdgt = new QTabWidget; | |
30 | this->mainlayout->addWidget(this->tabWdgt); |
|
30 | this->mainlayout->addWidget(this->tabWdgt); | |
31 | this->memEditorWdgt = new memEditor; |
|
31 | this->memEditorWdgt = new memEditor; | |
32 | this->tabWdgt->addTab(this->memEditorWdgt,tr("Memory editor")); |
|
32 | this->tabWdgt->addTab(this->memEditorWdgt,tr("Memory editor")); | |
33 | this->setLayout(this->mainlayout); |
|
33 | this->setLayout(this->mainlayout); | |
34 | connect(this->memEditorWdgt,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); |
|
34 | connect(this->memEditorWdgt,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); | |
35 | connect(this->memEditorWdgt,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); |
|
35 | connect(this->memEditorWdgt,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); | |
36 | connect(this,SIGNAL(refresh()),this->memEditorWdgt,SLOT(readMemSlt())); |
|
36 | connect(this,SIGNAL(refresh()),this->memEditorWdgt,SLOT(readMemSlt())); | |
37 | connect(this,SIGNAL(setAddress(quint32)),this->memEditorWdgt,SLOT(setAddress(quint32))); |
|
37 | connect(this,SIGNAL(setAddress(quint32)),this->memEditorWdgt,SLOT(setAddress(quint32))); | |
38 | connect(this,SIGNAL(setLength(quint32)),this->memEditorWdgt,SLOT(setLength(quint32))); |
|
38 | connect(this,SIGNAL(setLength(quint32)),this->memEditorWdgt,SLOT(setLength(quint32))); | |
39 |
|
39 | |||
40 | } |
|
40 | } | |
41 |
|
41 |
@@ -1,54 +1,54 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef AHBPLUGINUI_H |
|
22 | #ifndef AHBPLUGINUI_H | |
23 | #define AHBPLUGINUI_H |
|
23 | #define AHBPLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QHBoxLayout> |
|
26 | #include <QHBoxLayout> | |
27 | #include <QTabWidget> |
|
27 | #include <QTabWidget> | |
28 | #include <QPushButton> |
|
28 | #include <QPushButton> | |
29 | #include "memeditor.h" |
|
29 | #include "memeditor.h" | |
30 | #include <QSplitter> |
|
30 | #include <QSplitter> | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | class genericrwpluginUi : public QWidget |
|
33 | class genericrwpluginUi : public QWidget | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 | explicit genericrwpluginUi(QWidget *parent = 0); |
|
37 | explicit genericrwpluginUi(QWidget *parent = 0); | |
38 |
|
38 | |||
39 | signals: |
|
39 | signals: | |
40 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
40 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); | |
41 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
41 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); | |
42 | void refresh(); |
|
42 | void refresh(); | |
43 | void setAddress(quint32 address); |
|
43 | void setAddress(quint32 address); | |
44 | void setLength(quint32 length); |
|
44 | void setLength(quint32 length); | |
45 |
|
45 | |||
46 | private: |
|
46 | private: | |
47 | QSplitter* verticalSpliter; |
|
47 | QSplitter* verticalSpliter; | |
48 | QHBoxLayout* mainlayout; |
|
48 | QHBoxLayout* mainlayout; | |
49 | QTabWidget* tabWdgt; |
|
49 | QTabWidget* tabWdgt; | |
50 | memEditor* memEditorWdgt; |
|
50 | memEditor* memEditorWdgt; | |
51 |
|
51 | |||
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 | #endif // AHBPLUGINUI_H |
|
54 | #endif // AHBPLUGINUI_H |
@@ -1,98 +1,98 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "memeditor.h" |
|
22 | #include "memeditor.h" | |
23 | #include "malloc.h" |
|
23 | #include "malloc.h" | |
24 |
|
24 | |||
25 | memEditor::memEditor(QWidget *parent) : |
|
25 | memEditor::memEditor(QWidget *parent) : | |
26 | QWidget(parent) |
|
26 | QWidget(parent) | |
27 | { |
|
27 | { | |
28 | this->verticalSpliter = new QSplitter; |
|
28 | this->verticalSpliter = new QSplitter; | |
29 | this->ctrlWidget = new QWidget; |
|
29 | this->ctrlWidget = new QWidget; | |
30 | this->verticalSpliter->setOrientation(Qt::Horizontal); |
|
30 | this->verticalSpliter->setOrientation(Qt::Horizontal); | |
31 | this->mainLayout = new QHBoxLayout; |
|
31 | this->mainLayout = new QHBoxLayout; | |
32 | this->ctrlLayout = new QVBoxLayout; |
|
32 | this->ctrlLayout = new QVBoxLayout; | |
33 | this->hexEditor = new QHexEdit; |
|
33 | this->hexEditor = new QHexEdit; | |
34 | this->addressSpnBx = new QHexSpinBox; |
|
34 | this->addressSpnBx = new QHexSpinBox; | |
35 | this->SizeWidget = new MemSizeWdgt(256); |
|
35 | this->SizeWidget = new MemSizeWdgt(256); | |
36 | this->readMemQPb = new QPushButton(tr("Read Mem")); |
|
36 | this->readMemQPb = new QPushButton(tr("Read Mem")); | |
37 | this->writeMemQPb = new QPushButton(tr("Write Mem")); |
|
37 | this->writeMemQPb = new QPushButton(tr("Write Mem")); | |
38 | this->ctrlLayout->addWidget(this->addressSpnBx); |
|
38 | this->ctrlLayout->addWidget(this->addressSpnBx); | |
39 | this->ctrlLayout->addWidget(this->SizeWidget); |
|
39 | this->ctrlLayout->addWidget(this->SizeWidget); | |
40 | this->ctrlLayout->addWidget(this->readMemQPb); |
|
40 | this->ctrlLayout->addWidget(this->readMemQPb); | |
41 | this->ctrlLayout->addWidget(this->writeMemQPb); |
|
41 | this->ctrlLayout->addWidget(this->writeMemQPb); | |
42 | this->ctrlWidget->setLayout(this->ctrlLayout); |
|
42 | this->ctrlWidget->setLayout(this->ctrlLayout); | |
43 | this->verticalSpliter->addWidget(this->hexEditor); |
|
43 | this->verticalSpliter->addWidget(this->hexEditor); | |
44 | this->verticalSpliter->addWidget(this->ctrlWidget); |
|
44 | this->verticalSpliter->addWidget(this->ctrlWidget); | |
45 | this->mainLayout->addWidget(this->verticalSpliter); |
|
45 | this->mainLayout->addWidget(this->verticalSpliter); | |
46 | this->setLayout(this->mainLayout); |
|
46 | this->setLayout(this->mainLayout); | |
47 | connect(this->readMemQPb,SIGNAL(clicked()),this,SLOT(readMemSlt())); |
|
47 | connect(this->readMemQPb,SIGNAL(clicked()),this,SLOT(readMemSlt())); | |
48 | connect(this->writeMemQPb,SIGNAL(clicked()),this,SLOT(writeMemSlt())); |
|
48 | connect(this->writeMemQPb,SIGNAL(clicked()),this,SLOT(writeMemSlt())); | |
49 | this->SizeWidget->setMaximum(16384); |
|
49 | this->SizeWidget->setMaximum(16384); | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | void memEditor::writeMemSlt() |
|
52 | void memEditor::writeMemSlt() | |
53 | { |
|
53 | { | |
54 |
|
54 | |||
55 | QByteArray data = this->hexEditor->data(); |
|
55 | QByteArray data = this->hexEditor->data(); | |
56 | unsigned int length = data.length()/4; |
|
56 | unsigned int length = data.length()/4; | |
57 | unsigned int* buffer=(unsigned int*)malloc(length*sizeof(int)); |
|
57 | unsigned int* buffer=(unsigned int*)malloc(length*sizeof(int)); | |
58 | unsigned int address = this->hexEditor->addressOffset(); |
|
58 | unsigned int address = this->hexEditor->addressOffset(); | |
59 | for(int i=0;(unsigned int)i<length;i++) |
|
59 | for(int i=0;(unsigned int)i<length;i++) | |
60 | { |
|
60 | { | |
61 | buffer[i]=((data[4*i]<<24)&0xFF000000)+((data[(4*i)+1]<<16)&0x00FF0000)+((data[(4*i)+2]<<8)&0x0000FF00)+(data[(4*i)+3]&0x000000FF); |
|
61 | buffer[i]=((data[4*i]<<24)&0xFF000000)+((data[(4*i)+1]<<16)&0x00FF0000)+((data[(4*i)+2]<<8)&0x0000FF00)+(data[(4*i)+3]&0x000000FF); | |
62 | } |
|
62 | } | |
63 | emit this->WriteSig(buffer,length,address); |
|
63 | emit this->WriteSig(buffer,length,address); | |
64 | free(buffer); |
|
64 | free(buffer); | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | void memEditor::setAddress(quint32 address) |
|
67 | void memEditor::setAddress(quint32 address) | |
68 | { |
|
68 | { | |
69 | this->addressSpnBx->setValue(address); |
|
69 | this->addressSpnBx->setValue(address); | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | void memEditor::setLength(quint32 length) |
|
72 | void memEditor::setLength(quint32 length) | |
73 | { |
|
73 | { | |
74 | this->SizeWidget->setSizeValue(length); |
|
74 | this->SizeWidget->setSizeValue(length); | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | void memEditor::readMemSlt() |
|
77 | void memEditor::readMemSlt() | |
78 | { |
|
78 | { | |
79 | this->SizeWidget->updateSizeValue(); |
|
79 | this->SizeWidget->updateSizeValue(); | |
80 | unsigned int size = this->SizeWidget->getsize()/4; |
|
80 | unsigned int size = this->SizeWidget->getsize()/4; | |
81 | unsigned int buffer[16384]; |
|
81 | unsigned int buffer[16384]; | |
82 | unsigned char buffChar[16384*4]; |
|
82 | unsigned char buffChar[16384*4]; | |
83 | unsigned int address = this->addressSpnBx->value(); |
|
83 | unsigned int address = this->addressSpnBx->value(); | |
84 | if((emit this->ReadSig(buffer,size,address&(-4)))==size) |
|
84 | if((emit this->ReadSig(buffer,size,address&(-4)))==size) | |
85 | { |
|
85 | { | |
86 | for(int i=0;(unsigned int)i<size;i++) |
|
86 | for(int i=0;(unsigned int)i<size;i++) | |
87 | { |
|
87 | { | |
88 | buffChar[4*i]=(buffer[i]>>24)&0xFF; |
|
88 | buffChar[4*i]=(buffer[i]>>24)&0xFF; | |
89 | buffChar[(4*i)+1]=(buffer[i]>>16)&0xFF; |
|
89 | buffChar[(4*i)+1]=(buffer[i]>>16)&0xFF; | |
90 | buffChar[(4*i)+2]=(buffer[i]>>8)&0xFF; |
|
90 | buffChar[(4*i)+2]=(buffer[i]>>8)&0xFF; | |
91 | buffChar[(4*i)+3]=(buffer[i])&0xFF; |
|
91 | buffChar[(4*i)+3]=(buffer[i])&0xFF; | |
92 | } |
|
92 | } | |
93 | QByteArray data = QByteArray((char*)buffChar,size*4); |
|
93 | QByteArray data = QByteArray((char*)buffChar,size*4); | |
94 | this->hexEditor->setData(data); |
|
94 | this->hexEditor->setData(data); | |
95 | this->hexEditor->setAddressOffset(address&(-4)); |
|
95 | this->hexEditor->setAddressOffset(address&(-4)); | |
96 | this->addressSpnBx->setValue(address&(-4)); |
|
96 | this->addressSpnBx->setValue(address&(-4)); | |
97 | } |
|
97 | } | |
98 | } |
|
98 | } |
@@ -1,62 +1,62 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef MEMEDITOR_H |
|
22 | #ifndef MEMEDITOR_H | |
23 | #define MEMEDITOR_H |
|
23 | #define MEMEDITOR_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QVBoxLayout> |
|
26 | #include <QVBoxLayout> | |
27 | #include <QHBoxLayout> |
|
27 | #include <QHBoxLayout> | |
28 | #include <QPushButton> |
|
28 | #include <QPushButton> | |
29 | #include <QByteArray> |
|
29 | #include <QByteArray> | |
30 | #include <QSplitter> |
|
30 | #include <QSplitter> | |
31 | #include <qhexedit.h> |
|
31 | #include <qhexedit.h> | |
32 | #include <qhexspinbox.h> |
|
32 | #include <qhexspinbox.h> | |
33 | #include <memsizewdgt.h> |
|
33 | #include <memsizewdgt.h> | |
34 |
|
34 | |||
35 | class memEditor : public QWidget |
|
35 | class memEditor : public QWidget | |
36 | { |
|
36 | { | |
37 | Q_OBJECT |
|
37 | Q_OBJECT | |
38 | public: |
|
38 | public: | |
39 | explicit memEditor(QWidget *parent = 0); |
|
39 | explicit memEditor(QWidget *parent = 0); | |
40 |
|
40 | |||
41 | signals: |
|
41 | signals: | |
42 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
42 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); | |
43 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
43 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); | |
44 |
|
44 | |||
45 | public slots: |
|
45 | public slots: | |
46 | void readMemSlt(); |
|
46 | void readMemSlt(); | |
47 | void writeMemSlt(); |
|
47 | void writeMemSlt(); | |
48 | void setAddress(quint32 address); |
|
48 | void setAddress(quint32 address); | |
49 | void setLength(quint32 length); |
|
49 | void setLength(quint32 length); | |
50 | private: |
|
50 | private: | |
51 | QWidget* ctrlWidget; |
|
51 | QWidget* ctrlWidget; | |
52 | QSplitter* verticalSpliter; |
|
52 | QSplitter* verticalSpliter; | |
53 | QHBoxLayout* mainLayout; |
|
53 | QHBoxLayout* mainLayout; | |
54 | QVBoxLayout* ctrlLayout; |
|
54 | QVBoxLayout* ctrlLayout; | |
55 | QHexEdit* hexEditor; |
|
55 | QHexEdit* hexEditor; | |
56 | QHexSpinBox* addressSpnBx; |
|
56 | QHexSpinBox* addressSpnBx; | |
57 | QPushButton* readMemQPb; |
|
57 | QPushButton* readMemQPb; | |
58 | QPushButton* writeMemQPb; |
|
58 | QPushButton* writeMemQPb; | |
59 | MemSizeWdgt* SizeWidget; |
|
59 | MemSizeWdgt* SizeWidget; | |
60 | }; |
|
60 | }; | |
61 |
|
61 | |||
62 | #endif // MEMEDITOR_H |
|
62 | #endif // MEMEDITOR_H |
@@ -1,85 +1,85 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "memctrlrplugin.h" |
|
22 | #include "memctrlrplugin.h" | |
23 | #include "memctrlrpywrapper.h" |
|
23 | #include "memctrlrpywrapper.h" | |
24 |
|
24 | |||
25 | memctrlrplugin::memctrlrplugin(QWidget *parent):socexplorerplugin(parent,false) |
|
25 | memctrlrplugin::memctrlrplugin(QWidget *parent):socexplorerplugin(parent,false) | |
26 | { |
|
26 | { | |
27 | this->UI = new memctrlrPluginUi(); |
|
27 | this->UI = new memctrlrPluginUi(); | |
28 | this->setWidget((QWidget*)this->UI); |
|
28 | this->setWidget((QWidget*)this->UI); | |
29 | connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); |
|
29 | connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); | |
30 | connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
30 | connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); | |
31 | this->pyObject = new memctrlrPyWrapper(this); |
|
31 | this->pyObject = new memctrlrPyWrapper(this); | |
32 | connect(this->pyObject,SIGNAL(launchTest(uint,uint)),this,SLOT(launchTest(uint,uint))); |
|
32 | connect(this->pyObject,SIGNAL(launchTest(uint,uint)),this,SLOT(launchTest(uint,uint))); | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | memctrlrplugin::~memctrlrplugin() |
|
35 | memctrlrplugin::~memctrlrplugin() | |
36 | {} |
|
36 | {} | |
37 |
|
37 | |||
38 | int memctrlrplugin::registermenu(QMainWindow *menuHolder) |
|
38 | int memctrlrplugin::registermenu(QMainWindow *menuHolder) | |
39 | { |
|
39 | { | |
40 | this->menu = menuHolder->menuBar()->addMenu(tr("&Memory Controler")); |
|
40 | this->menu = menuHolder->menuBar()->addMenu(tr("&Memory Controler")); | |
41 | this->closeAction = this->menu->addAction(tr("Close plugin")); |
|
41 | this->closeAction = this->menu->addAction(tr("Close plugin")); | |
42 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); |
|
42 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); | |
43 | return 1; |
|
43 | return 1; | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | unsigned int memctrlrplugin::Write(unsigned int *Value,unsigned int count,unsigned int address) |
|
46 | unsigned int memctrlrplugin::Write(unsigned int *Value,unsigned int count,unsigned int address) | |
47 | { |
|
47 | { | |
48 | if(parent) |
|
48 | if(parent) | |
49 | return parent->Write(Value,count,address); |
|
49 | return parent->Write(Value,count,address); | |
50 | return 0; |
|
50 | return 0; | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | unsigned int memctrlrplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
53 | unsigned int memctrlrplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
54 | { |
|
54 | { | |
55 | if(parent) |
|
55 | if(parent) | |
56 | return parent->Read(Value,count,address); |
|
56 | return parent->Read(Value,count,address); | |
57 | return 0; |
|
57 | return 0; | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | bool memctrlrplugin::launchTest(unsigned int baseAddress,unsigned int size) |
|
61 | bool memctrlrplugin::launchTest(unsigned int baseAddress,unsigned int size) | |
62 | { |
|
62 | { | |
63 | if(parent==NULL)return false; |
|
63 | if(parent==NULL)return false; | |
64 | unsigned int* dataLocal = (unsigned int*)malloc(size); |
|
64 | unsigned int* dataLocal = (unsigned int*)malloc(size); | |
65 | unsigned int* dataOnBoard = (unsigned int*)malloc(size); |
|
65 | unsigned int* dataOnBoard = (unsigned int*)malloc(size); | |
66 | bool res=true; |
|
66 | bool res=true; | |
67 | for(int i=0;(unsigned int)i<(size>>2);i++) |
|
67 | for(int i=0;(unsigned int)i<(size>>2);i++) | |
68 | { |
|
68 | { | |
69 | dataLocal[i]= (0xFFFF&rand())+(rand()<<16); |
|
69 | dataLocal[i]= (0xFFFF&rand())+(rand()<<16); | |
70 | } |
|
70 | } | |
71 | parent->Write(dataLocal,size>>2,baseAddress); |
|
71 | parent->Write(dataLocal,size>>2,baseAddress); | |
72 | parent->Read(dataOnBoard,size>>2,baseAddress); |
|
72 | parent->Read(dataOnBoard,size>>2,baseAddress); | |
73 | for(int i=0;(unsigned int)i<(size>>2);i++) |
|
73 | for(int i=0;(unsigned int)i<(size>>2);i++) | |
74 | { |
|
74 | { | |
75 | if(dataLocal[i]!=dataOnBoard[i]) |
|
75 | if(dataLocal[i]!=dataOnBoard[i]) | |
76 | res=false; |
|
76 | res=false; | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | free(dataLocal); |
|
79 | free(dataLocal); | |
80 | free(dataOnBoard); |
|
80 | free(dataOnBoard); | |
81 | return res; |
|
81 | return res; | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 |
|
84 | |||
85 |
|
85 |
@@ -1,50 +1,50 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef MEMCTRLRPLUGIN_H |
|
22 | #ifndef MEMCTRLRPLUGIN_H | |
23 | #define MEMCTRLRPLUGIN_H |
|
23 | #define MEMCTRLRPLUGIN_H | |
24 | #include "memctrlrpluginui.h" |
|
24 | #include "memctrlrpluginui.h" | |
25 | #include <QMenuBar> |
|
25 | #include <QMenuBar> | |
26 | #include <QMenu> |
|
26 | #include <QMenu> | |
27 | #include <QAction> |
|
27 | #include <QAction> | |
28 | #include <QMainWindow> |
|
28 | #include <QMainWindow> | |
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 |
|
30 | |||
31 | #include <socexplorerplugin.h> |
|
31 | #include <socexplorerplugin.h> | |
32 |
|
32 | |||
33 | class memctrlrplugin : public socexplorerplugin |
|
33 | class memctrlrplugin : public socexplorerplugin | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 | explicit memctrlrplugin(QWidget *parent = 0); |
|
37 | explicit memctrlrplugin(QWidget *parent = 0); | |
38 | ~memctrlrplugin(); |
|
38 | ~memctrlrplugin(); | |
39 | int registermenu(QMainWindow *menuHolder); |
|
39 | int registermenu(QMainWindow *menuHolder); | |
40 | public slots: |
|
40 | public slots: | |
41 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
41 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
42 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
42 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
43 | bool launchTest(unsigned int baseAddress,unsigned int size); |
|
43 | bool launchTest(unsigned int baseAddress,unsigned int size); | |
44 | signals: |
|
44 | signals: | |
45 |
|
45 | |||
46 | private: |
|
46 | private: | |
47 | memctrlrPluginUi* UI; |
|
47 | memctrlrPluginUi* UI; | |
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 | #endif // MEMCTRLRPLUGIN_H |
|
50 | #endif // MEMCTRLRPLUGIN_H |
@@ -1,36 +1,36 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "memctrlrpluginui.h" |
|
22 | #include "memctrlrpluginui.h" | |
23 |
|
23 | |||
24 | memctrlrPluginUi::memctrlrPluginUi(QWidget *parent) : |
|
24 | memctrlrPluginUi::memctrlrPluginUi(QWidget *parent) : | |
25 | QWidget(parent) |
|
25 | QWidget(parent) | |
26 | { |
|
26 | { | |
27 | this->mainlayout = new QHBoxLayout; |
|
27 | this->mainlayout = new QHBoxLayout; | |
28 | this->memorycheckWdgt = new memorycheck; |
|
28 | this->memorycheckWdgt = new memorycheck; | |
29 | this->tabWdgt = new QTabWidget; |
|
29 | this->tabWdgt = new QTabWidget; | |
30 | this->tabWdgt->addTab(this->memorycheckWdgt,QString(tr("Memory Check"))); |
|
30 | this->tabWdgt->addTab(this->memorycheckWdgt,QString(tr("Memory Check"))); | |
31 | this->mainlayout->addWidget(this->tabWdgt); |
|
31 | this->mainlayout->addWidget(this->tabWdgt); | |
32 | this->setLayout(this->mainlayout); |
|
32 | this->setLayout(this->mainlayout); | |
33 | connect(this->memorycheckWdgt,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); |
|
33 | connect(this->memorycheckWdgt,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint))); | |
34 | connect(this->memorycheckWdgt,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); |
|
34 | connect(this->memorycheckWdgt,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint))); | |
35 | } |
|
35 | } | |
36 |
|
36 |
@@ -1,49 +1,49 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2011, |
|
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef MEMCTRLRPLUGINUI_H |
|
22 | #ifndef MEMCTRLRPLUGINUI_H | |
23 | #define MEMCTRLRPLUGINUI_H |
|
23 | #define MEMCTRLRPLUGINUI_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QHBoxLayout> |
|
26 | #include <QHBoxLayout> | |
27 | #include <QPushButton> |
|
27 | #include <QPushButton> | |
28 | #include <QTabWidget> |
|
28 | #include <QTabWidget> | |
29 | #include "memorycheck.h" |
|
29 | #include "memorycheck.h" | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | class memctrlrPluginUi : public QWidget |
|
32 | class memctrlrPluginUi : public QWidget | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 | explicit memctrlrPluginUi(QWidget *parent = 0); |
|
36 | explicit memctrlrPluginUi(QWidget *parent = 0); | |
37 |
|
37 | |||
38 | signals: |
|
38 | signals: | |
39 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
39 | unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address); | |
40 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); |
|
40 | unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address); | |
41 |
|
41 | |||
42 | private: |
|
42 | private: | |
43 | QHBoxLayout* mainlayout; |
|
43 | QHBoxLayout* mainlayout; | |
44 | QTabWidget* tabWdgt; |
|
44 | QTabWidget* tabWdgt; | |
45 | memorycheck* memorycheckWdgt; |
|
45 | memorycheck* memorycheckWdgt; | |
46 |
|
46 | |||
47 | }; |
|
47 | }; | |
48 |
|
48 | |||
49 | #endif |
|
49 | #endif |
@@ -1,51 +1,51 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "abstractspwbridge.h" |
|
22 | #include "abstractspwbridge.h" | |
23 |
|
23 | |||
24 | abstractSpwBridge::abstractSpwBridge(socexplorerplugin *parent) |
|
24 | abstractSpwBridge::abstractSpwBridge(socexplorerplugin *parent) | |
25 | :QObject((QObject*)parent) |
|
25 | :QObject((QObject*)parent) | |
26 | { |
|
26 | { | |
27 | this->plugin = parent; |
|
27 | this->plugin = parent; | |
28 | this->p_GUI=NULL; |
|
28 | this->p_GUI=NULL; | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 | QWidget *abstractSpwBridge::getGUI() |
|
31 | QWidget *abstractSpwBridge::getGUI() | |
32 | { |
|
32 | { | |
33 | return this->p_GUI; |
|
33 | return this->p_GUI; | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | bool abstractSpwBridge::connectBridge() |
|
36 | bool abstractSpwBridge::connectBridge() | |
37 | { |
|
37 | { | |
38 | return false; |
|
38 | return false; | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | bool abstractSpwBridge::disconnectBridge() |
|
41 | bool abstractSpwBridge::disconnectBridge() | |
42 | { |
|
42 | { | |
43 | return false; |
|
43 | return false; | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 |
|
46 | |||
47 |
|
47 | |||
48 |
|
48 | |||
49 |
|
49 | |||
50 |
|
50 | |||
51 |
|
51 |
@@ -1,50 +1,52 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef ABSTRACTSPWBRIDGE_H |
|
22 | #ifndef ABSTRACTSPWBRIDGE_H | |
23 | #define ABSTRACTSPWBRIDGE_H |
|
23 | #define ABSTRACTSPWBRIDGE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <socexplorerplugin.h> |
|
26 | #include <socexplorerplugin.h> | |
27 | #define RMAP_MAX_XFER_SIZE 4000 //slightly less than 16kBytes |
|
27 | #define RMAP_MAX_XFER_SIZE 4000 //slightly less than 16kBytes | |
28 | #include <spw.h> |
|
28 | #include <spw.h> | |
29 |
|
29 | |||
30 | class abstractSpwBridge : public QObject |
|
30 | class abstractSpwBridge : public QObject | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | public: |
|
33 | public: | |
34 | explicit abstractSpwBridge(socexplorerplugin *parent); |
|
34 | explicit abstractSpwBridge(socexplorerplugin *parent); | |
35 | QWidget *getGUI(); |
|
35 | QWidget *getGUI(); | |
36 |
|
36 | |||
37 | public slots: |
|
37 | public slots: | |
38 | virtual bool connectBridge(); |
|
38 | virtual bool connectBridge(); | |
39 | virtual bool disconnectBridge(); |
|
39 | virtual bool disconnectBridge(); | |
40 | virtual unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0)=0; |
|
40 | virtual unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0)=0; | |
41 | virtual unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0)=0; |
|
41 | virtual unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0)=0; | |
42 | virtual int pushRMAPPacket(char* packet,int size)=0; |
|
42 | virtual int pushRMAPPacket(char* packet,int size)=0; | |
|
43 | signals: | |||
|
44 | void setConnected(bool connected); | |||
43 | protected: |
|
45 | protected: | |
44 | socexplorerplugin* plugin; |
|
46 | socexplorerplugin* plugin; | |
45 | QWidget* p_GUI; |
|
47 | QWidget* p_GUI; | |
46 | private: |
|
48 | private: | |
47 |
|
49 | |||
48 | }; |
|
50 | }; | |
49 |
|
51 | |||
50 | #endif // ABSTRACTSPWBRIDGE_H |
|
52 | #endif // ABSTRACTSPWBRIDGE_H |
@@ -1,213 +1,213 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef SPW_H |
|
22 | #ifndef SPW_H | |
23 | #define SPW_H |
|
23 | #define SPW_H | |
24 | #include <stdint.h> |
|
24 | #include <stdint.h> | |
25 |
|
25 | |||
26 | /* |
|
26 | /* | |
27 | ███████╗██████╗ ██╗ ██╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗ ██████╗ ███╗ ██╗ |
|
27 | ███████╗██████╗ ██╗ ██╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗ ██████╗ ███╗ ██╗ | |
28 | ██╔════╝██╔══██╗██║ ██║ ██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔═══██╗████╗ ██║ |
|
28 | ██╔════╝██╔══██╗██║ ██║ ██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔═══██╗████╗ ██║ | |
29 | ███████╗██████╔╝██║ █╗ ██║ ██║ ██║ ██║██╔████╔██║██╔████╔██║██║ ██║██╔██╗ ██║ |
|
29 | ███████╗██████╔╝██║ █╗ ██║ ██║ ██║ ██║██╔████╔██║██╔████╔██║██║ ██║██╔██╗ ██║ | |
30 | ╚════██║██╔═══╝ ██║███╗██║ ██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██║ ██║██║╚██╗██║ |
|
30 | ╚════██║██╔═══╝ ██║███╗██║ ██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██║ ██║██║╚██╗██║ | |
31 | ███████║██║ ╚███╔███╔╝ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║╚██████╔╝██║ ╚████║ |
|
31 | ███████║██║ ╚███╔███╔╝ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║╚██████╔╝██║ ╚████║ | |
32 | ╚══════╝╚═╝ ╚══╝╚══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ |
|
32 | ╚══════╝╚═╝ ╚══╝╚══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ | |
33 | */ |
|
33 | */ | |
34 |
|
34 | |||
35 | enum SPW_PROTOCOL_IDs{ |
|
35 | enum SPW_PROTOCOL_IDs{ | |
36 | SPW_PROTO_ID_EXTEND =0, |
|
36 | SPW_PROTO_ID_EXTEND =0, | |
37 | SPW_PROTO_ID_RMAP = 1, |
|
37 | SPW_PROTO_ID_RMAP = 1, | |
38 | SPW_PROTO_ID_CCSDS = 2, |
|
38 | SPW_PROTO_ID_CCSDS = 2, | |
39 | SPW_PROTO_ID_GOES_R = 238, |
|
39 | SPW_PROTO_ID_GOES_R = 238, | |
40 | SPW_PROTO_ID_STUP = 239 |
|
40 | SPW_PROTO_ID_STUP = 239 | |
41 | }; |
|
41 | }; | |
42 |
|
42 | |||
43 | static const unsigned char SPW_CRCTable[] = { |
|
43 | static const unsigned char SPW_CRCTable[] = { | |
44 | 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, |
|
44 | 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, | |
45 | 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, |
|
45 | 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, | |
46 | 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, |
|
46 | 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, | |
47 | 0x12, 0x83, 0xf1, 0x60, 0x15, 0x84, 0xf6, 0x67, |
|
47 | 0x12, 0x83, 0xf1, 0x60, 0x15, 0x84, 0xf6, 0x67, | |
48 | 0x38, 0xa9, 0xdb, 0x4a, 0x3f, 0xae, 0xdc, 0x4d, |
|
48 | 0x38, 0xa9, 0xdb, 0x4a, 0x3f, 0xae, 0xdc, 0x4d, | |
49 | 0x36, 0xa7, 0xd5, 0x44, 0x31, 0xa0, 0xd2, 0x43, |
|
49 | 0x36, 0xa7, 0xd5, 0x44, 0x31, 0xa0, 0xd2, 0x43, | |
50 | 0x24, 0xb5, 0xc7, 0x56, 0x23, 0xb2, 0xc0, 0x51, |
|
50 | 0x24, 0xb5, 0xc7, 0x56, 0x23, 0xb2, 0xc0, 0x51, | |
51 | 0x2a, 0xbb, 0xc9, 0x58, 0x2d, 0xbc, 0xce, 0x5f, |
|
51 | 0x2a, 0xbb, 0xc9, 0x58, 0x2d, 0xbc, 0xce, 0x5f, | |
52 | 0x70, 0xe1, 0x93, 0x02, 0x77, 0xe6, 0x94, 0x05, |
|
52 | 0x70, 0xe1, 0x93, 0x02, 0x77, 0xe6, 0x94, 0x05, | |
53 | 0x7e, 0xef, 0x9d, 0x0c, 0x79, 0xe8, 0x9a, 0x0b, |
|
53 | 0x7e, 0xef, 0x9d, 0x0c, 0x79, 0xe8, 0x9a, 0x0b, | |
54 | 0x6c, 0xfd, 0x8f, 0x1e, 0x6b, 0xfa, 0x88, 0x19, |
|
54 | 0x6c, 0xfd, 0x8f, 0x1e, 0x6b, 0xfa, 0x88, 0x19, | |
55 | 0x62, 0xf3, 0x81, 0x10, 0x65, 0xf4, 0x86, 0x17, |
|
55 | 0x62, 0xf3, 0x81, 0x10, 0x65, 0xf4, 0x86, 0x17, | |
56 | 0x48, 0xd9, 0xab, 0x3a, 0x4f, 0xde, 0xac, 0x3d, |
|
56 | 0x48, 0xd9, 0xab, 0x3a, 0x4f, 0xde, 0xac, 0x3d, | |
57 | 0x46, 0xd7, 0xa5, 0x34, 0x41, 0xd0, 0xa2, 0x33, |
|
57 | 0x46, 0xd7, 0xa5, 0x34, 0x41, 0xd0, 0xa2, 0x33, | |
58 | 0x54, 0xc5, 0xb7, 0x26, 0x53, 0xc2, 0xb0, 0x21, |
|
58 | 0x54, 0xc5, 0xb7, 0x26, 0x53, 0xc2, 0xb0, 0x21, | |
59 | 0x5a, 0xcb, 0xb9, 0x28, 0x5d, 0xcc, 0xbe, 0x2f, |
|
59 | 0x5a, 0xcb, 0xb9, 0x28, 0x5d, 0xcc, 0xbe, 0x2f, | |
60 | 0xe0, 0x71, 0x03, 0x92, 0xe7, 0x76, 0x04, 0x95, |
|
60 | 0xe0, 0x71, 0x03, 0x92, 0xe7, 0x76, 0x04, 0x95, | |
61 | 0xee, 0x7f, 0x0d, 0x9c, 0xe9, 0x78, 0x0a, 0x9b, |
|
61 | 0xee, 0x7f, 0x0d, 0x9c, 0xe9, 0x78, 0x0a, 0x9b, | |
62 | 0xfc, 0x6d, 0x1f, 0x8e, 0xfb, 0x6a, 0x18, 0x89, |
|
62 | 0xfc, 0x6d, 0x1f, 0x8e, 0xfb, 0x6a, 0x18, 0x89, | |
63 | 0xf2, 0x63, 0x11, 0x80, 0xf5, 0x64, 0x16, 0x87, |
|
63 | 0xf2, 0x63, 0x11, 0x80, 0xf5, 0x64, 0x16, 0x87, | |
64 | 0xd8, 0x49, 0x3b, 0xaa, 0xdf, 0x4e, 0x3c, 0xad, |
|
64 | 0xd8, 0x49, 0x3b, 0xaa, 0xdf, 0x4e, 0x3c, 0xad, | |
65 | 0xd6, 0x47, 0x35, 0xa4, 0xd1, 0x40, 0x32, 0xa3, |
|
65 | 0xd6, 0x47, 0x35, 0xa4, 0xd1, 0x40, 0x32, 0xa3, | |
66 | 0xc4, 0x55, 0x27, 0xb6, 0xc3, 0x52, 0x20, 0xb1, |
|
66 | 0xc4, 0x55, 0x27, 0xb6, 0xc3, 0x52, 0x20, 0xb1, | |
67 | 0xca, 0x5b, 0x29, 0xb8, 0xcd, 0x5c, 0x2e, 0xbf, |
|
67 | 0xca, 0x5b, 0x29, 0xb8, 0xcd, 0x5c, 0x2e, 0xbf, | |
68 | 0x90, 0x01, 0x73, 0xe2, 0x97, 0x06, 0x74, 0xe5, |
|
68 | 0x90, 0x01, 0x73, 0xe2, 0x97, 0x06, 0x74, 0xe5, | |
69 | 0x9e, 0x0f, 0x7d, 0xec, 0x99, 0x08, 0x7a, 0xeb, |
|
69 | 0x9e, 0x0f, 0x7d, 0xec, 0x99, 0x08, 0x7a, 0xeb, | |
70 | 0x8c, 0x1d, 0x6f, 0xfe, 0x8b, 0x1a, 0x68, 0xf9, |
|
70 | 0x8c, 0x1d, 0x6f, 0xfe, 0x8b, 0x1a, 0x68, 0xf9, | |
71 | 0x82, 0x13, 0x61, 0xf0, 0x85, 0x14, 0x66, 0xf7, |
|
71 | 0x82, 0x13, 0x61, 0xf0, 0x85, 0x14, 0x66, 0xf7, | |
72 | 0xa8, 0x39, 0x4b, 0xda, 0xaf, 0x3e, 0x4c, 0xdd, |
|
72 | 0xa8, 0x39, 0x4b, 0xda, 0xaf, 0x3e, 0x4c, 0xdd, | |
73 | 0xa6, 0x37, 0x45, 0xd4, 0xa1, 0x30, 0x42, 0xd3, |
|
73 | 0xa6, 0x37, 0x45, 0xd4, 0xa1, 0x30, 0x42, 0xd3, | |
74 | 0xb4, 0x25, 0x57, 0xc6, 0xb3, 0x22, 0x50, 0xc1, |
|
74 | 0xb4, 0x25, 0x57, 0xc6, 0xb3, 0x22, 0x50, 0xc1, | |
75 | 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf |
|
75 | 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf | |
76 | }; |
|
76 | }; | |
77 |
|
77 | |||
78 | inline unsigned char _spw_CRC_(unsigned char INCR, unsigned char INBYTE) |
|
78 | inline unsigned char _spw_CRC_(unsigned char INCR, unsigned char INBYTE) | |
79 | { |
|
79 | { | |
80 | return SPW_CRCTable[INCR ^ INBYTE]; |
|
80 | return SPW_CRCTable[INCR ^ INBYTE]; | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | inline char spw_CRC(char* buffer, int size) |
|
83 | inline char spw_CRC(char* buffer, int size) | |
84 | { |
|
84 | { | |
85 | unsigned char CRC = 0; |
|
85 | unsigned char CRC = 0; | |
86 | for(int i=0;i<size;i++) |
|
86 | for(int i=0;i<size;i++) | |
87 | { |
|
87 | { | |
88 | CRC = _spw_CRC_(CRC,(unsigned char)buffer[i]); |
|
88 | CRC = _spw_CRC_(CRC,(unsigned char)buffer[i]); | |
89 | } |
|
89 | } | |
90 | return CRC; |
|
90 | return CRC; | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 | /* |
|
93 | /* | |
94 | ██████╗ ███╗ ███╗ █████╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ██████╗ ██████╗ ██████╗ ██╗ |
|
94 | ██████╗ ███╗ ███╗ █████╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ██████╗ ██████╗ ██████╗ ██╗ | |
95 | ██╔══██╗████╗ ████║██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔═══██╗╚══██╔══╝██╔═══██╗██╔════╝██╔═══██╗██║ |
|
95 | ██╔══██╗████╗ ████║██╔══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔═══██╗╚══██╔══╝██╔═══██╗██╔════╝██╔═══██╗██║ | |
96 | ██████╔╝██╔████╔██║███████║██████╔╝ ██████╔╝██████╔╝██║ ██║ ██║ ██║ ██║██║ ██║ ██║██║ |
|
96 | ██████╔╝██╔████╔██║███████║██████╔╝ ██████╔╝██████╔╝██║ ██║ ██║ ██║ ██║██║ ██║ ██║██║ | |
97 | ██╔══██╗██║╚██╔╝██║██╔══██║██╔═══╝ ██╔═══╝ ██╔══██╗██║ ██║ ██║ ██║ ██║██║ ██║ ██║██║ |
|
97 | ██╔══██╗██║╚██╔╝██║██╔══██║██╔═══╝ ██╔═══╝ ██╔══██╗██║ ██║ ██║ ██║ ██║██║ ██║ ██║██║ | |
98 | ██║ ██║██║ ╚═╝ ██║██║ ██║██║ ██║ ██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╗╚██████╔╝███████╗ |
|
98 | ██║ ██║██║ ╚═╝ ██║██║ ██║██║ ██║ ██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╗╚██████╔╝███████╗ | |
99 | ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ |
|
99 | ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ | |
100 | */ |
|
100 | */ | |
101 |
|
101 | |||
102 | enum RMAP_CMD_CODE{ |
|
102 | enum RMAP_CMD_CODE{ | |
103 | RMAP_CMD_CODE_invalid0, //0000 |
|
103 | RMAP_CMD_CODE_invalid0, //0000 | |
104 | RMAP_CMD_CODE_invalid1, //0001 |
|
104 | RMAP_CMD_CODE_invalid1, //0001 | |
105 | RMAP_CMD_CODE_read_Single, //0010 |
|
105 | RMAP_CMD_CODE_read_Single, //0010 | |
106 | RMAP_CMD_CODE_read_Inc, //0011 |
|
106 | RMAP_CMD_CODE_read_Inc, //0011 | |
107 | RMAP_CMD_CODE_invalid2, //0100 |
|
107 | RMAP_CMD_CODE_invalid2, //0100 | |
108 | RMAP_CMD_CODE_invalid3, //0101 |
|
108 | RMAP_CMD_CODE_invalid3, //0101 | |
109 | RMAP_CMD_CODE_invalid4, //0110 |
|
109 | RMAP_CMD_CODE_invalid4, //0110 | |
110 | RMAP_CMD_CODE_readModWri_Inc, //0111 |
|
110 | RMAP_CMD_CODE_readModWri_Inc, //0111 | |
111 | RMAP_CMD_CODE_writeSingle_noVer_noRep, //1000 |
|
111 | RMAP_CMD_CODE_writeSingle_noVer_noRep, //1000 | |
112 | RMAP_CMD_CODE_writeInc_noVer_noRep, //1001 |
|
112 | RMAP_CMD_CODE_writeInc_noVer_noRep, //1001 | |
113 | RMAP_CMD_CODE_writeSingle_noVer_Rep, //1010 |
|
113 | RMAP_CMD_CODE_writeSingle_noVer_Rep, //1010 | |
114 | RMAP_CMD_CODE_writeInc_noVer_Rep, //1011 |
|
114 | RMAP_CMD_CODE_writeInc_noVer_Rep, //1011 | |
115 | RMAP_CMD_CODE_writeSingle_ver_noRep, //1100 |
|
115 | RMAP_CMD_CODE_writeSingle_ver_noRep, //1100 | |
116 | RMAP_CMD_CODE_writeInc_ver_noRep, //1101 |
|
116 | RMAP_CMD_CODE_writeInc_ver_noRep, //1101 | |
117 | RMAP_CMD_CODE_writeSingle_ver_rep, //1110 |
|
117 | RMAP_CMD_CODE_writeSingle_ver_rep, //1110 | |
118 | RMAP_CMD_CODE_writeInc_ver_rep //1111 |
|
118 | RMAP_CMD_CODE_writeInc_ver_rep //1111 | |
119 | }; |
|
119 | }; | |
120 |
|
120 | |||
121 | /* |
|
121 | /* | |
122 | * Rmap read command header: |
|
122 | * Rmap read command header: | |
123 | * |
|
123 | * | |
124 | * | Destination Logical Address | Protocol identifier | Packet type | Destination key | |
|
124 | * | Destination Logical Address | Protocol identifier | Packet type | Destination key | | |
125 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
125 | * |-----------------------------|------------------------|------------------------|------------------------| | |
126 | * | Source Logical Address | Transaction identifier | Transaction identifier | Extended read address | |
|
126 | * | Source Logical Address | Transaction identifier | Transaction identifier | Extended read address | | |
127 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
127 | * |-----------------------------|------------------------|------------------------|------------------------| | |
128 | * | Read address MSB | Read address | Read address | Read address LSB | |
|
128 | * | Read address MSB | Read address | Read address | Read address LSB | | |
129 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
129 | * |-----------------------------|------------------------|------------------------|------------------------| | |
130 | * | Data length MSB | Data length | Data length LSB | CRC | |
|
130 | * | Data length MSB | Data length | Data length LSB | CRC | | |
131 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
131 | * |-----------------------------|------------------------|------------------------|------------------------| | |
132 | * |
|
132 | * | |
133 | * Packet type field: |
|
133 | * Packet type field: | |
134 | * |
|
134 | * | |
135 | * | msb |
|
135 | * | msb | |
136 | * | reserved = 0 | Comand = 1| Read = 0 | Read = 0 | Read = 1 | Increment/ | Source Path | Source Path | |
|
136 | * | reserved = 0 | Comand = 1| Read = 0 | Read = 0 | Read = 1 | Increment/ | Source Path | Source Path | | |
137 | * | (Ack/NoAck) | No Inc. address | Address Length | Address Length | |
|
137 | * | (Ack/NoAck) | No Inc. address | Address Length | Address Length | | |
138 | * |
|
138 | * | |
139 | */ |
|
139 | */ | |
140 | #define RMAP_READ_HEADER_MIN_SZ 16 |
|
140 | #define RMAP_READ_HEADER_MIN_SZ 16 | |
141 |
|
141 | |||
142 | inline void RMAP_build_rx_request_header(char destinationLogicalAddress, char destKey,char sourceLogicalAddress,uint16_t transactionID,int readAddress,int length,char *buffer) |
|
142 | inline void RMAP_build_rx_request_header(char destinationLogicalAddress, char destKey,char sourceLogicalAddress,uint16_t transactionID,int readAddress,int length,char *buffer) | |
143 | { |
|
143 | { | |
144 | buffer[0] = destinationLogicalAddress; |
|
144 | buffer[0] = destinationLogicalAddress; | |
145 | buffer[1] = SPW_PROTO_ID_RMAP; |
|
145 | buffer[1] = SPW_PROTO_ID_RMAP; | |
146 | buffer[2] = 0b01001100; |
|
146 | buffer[2] = 0b01001100; | |
147 | buffer[3] = destKey; |
|
147 | buffer[3] = destKey; | |
148 | buffer[4] = sourceLogicalAddress; |
|
148 | buffer[4] = sourceLogicalAddress; | |
149 | buffer[5] = (char)(transactionID >> 8); |
|
149 | buffer[5] = (char)(transactionID >> 8); | |
150 | buffer[6] = (char)(transactionID); |
|
150 | buffer[6] = (char)(transactionID); | |
151 | buffer[7] = 0; |
|
151 | buffer[7] = 0; | |
152 | buffer[8] = (char)(readAddress >> 24); |
|
152 | buffer[8] = (char)(readAddress >> 24); | |
153 | buffer[9] = (char)(readAddress >> 16); |
|
153 | buffer[9] = (char)(readAddress >> 16); | |
154 | buffer[10] = (char)(readAddress >> 8); |
|
154 | buffer[10] = (char)(readAddress >> 8); | |
155 | buffer[11] = (char)(readAddress); |
|
155 | buffer[11] = (char)(readAddress); | |
156 | buffer[12] = (char)(length >> 16); |
|
156 | buffer[12] = (char)(length >> 16); | |
157 | buffer[13] = (char)(length >> 8); |
|
157 | buffer[13] = (char)(length >> 8); | |
158 | buffer[14] = (char)(length); |
|
158 | buffer[14] = (char)(length); | |
159 | buffer[15] = (char)spw_CRC(buffer,15); |
|
159 | buffer[15] = (char)spw_CRC(buffer,15); | |
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | inline int RMAP_get_transactionID(char *packet) |
|
162 | inline int RMAP_get_transactionID(char *packet) | |
163 | { |
|
163 | { | |
164 | return ((((unsigned int)packet[5])<<8) + ((unsigned int)packet[6])); |
|
164 | return ((((unsigned int)packet[5])<<8) + ((unsigned int)packet[6])); | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 |
|
167 | |||
168 | /* |
|
168 | /* | |
169 | * Rmap Write command header: |
|
169 | * Rmap Write command header: | |
170 | * |
|
170 | * | |
171 | * | Destination Logical Address | Protocol identifier | Packet type | Destination key | |
|
171 | * | Destination Logical Address | Protocol identifier | Packet type | Destination key | | |
172 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
172 | * |-----------------------------|------------------------|------------------------|------------------------| | |
173 | * | Source Logical Address | Transaction identifier | Transaction identifier | Extended write address | |
|
173 | * | Source Logical Address | Transaction identifier | Transaction identifier | Extended write address | | |
174 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
174 | * |-----------------------------|------------------------|------------------------|------------------------| | |
175 | * | Write address MSB | Write address | Write address | Write address LSB | |
|
175 | * | Write address MSB | Write address | Write address | Write address LSB | | |
176 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
176 | * |-----------------------------|------------------------|------------------------|------------------------| | |
177 | * | Data length MSB | Data length | Data length LSB | Header CRC | |
|
177 | * | Data length MSB | Data length | Data length LSB | Header CRC | | |
178 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
178 | * |-----------------------------|------------------------|------------------------|------------------------| | |
179 | * | Data | (...) | Last data byte | Data CRC | |
|
179 | * | Data | (...) | Last data byte | Data CRC | | |
180 | * |-----------------------------|------------------------|------------------------|------------------------| |
|
180 | * |-----------------------------|------------------------|------------------------|------------------------| | |
181 | * |
|
181 | * | |
182 | * Packet type field: |
|
182 | * Packet type field: | |
183 | * |
|
183 | * | |
184 | * | msb |
|
184 | * | msb | |
185 | * | reserved = 0 | Comand = 1| Write = 1 | Verify data = 1 | Ack = 1 | Increment/ | Source Path | Source Path | |
|
185 | * | reserved = 0 | Comand = 1| Write = 1 | Verify data = 1 | Ack = 1 | Increment/ | Source Path | Source Path | | |
186 | * | Don't Verify data = 0 | No Ack = 0 | No Inc. address | Address Length | Address Length | |
|
186 | * | Don't Verify data = 0 | No Ack = 0 | No Inc. address | Address Length | Address Length | | |
187 | * |
|
187 | * | |
188 | */ |
|
188 | */ | |
189 | #define RMAP_WRITE_HEADER_MIN_SZ 16 |
|
189 | #define RMAP_WRITE_HEADER_MIN_SZ 16 | |
190 | #define RMAP_WRITE_PACKET_MIN_SZ(bytesCnt) (RMAP_WRITE_HEADER_MIN_SZ+bytesCnt+1) //header=16 + data + data CRC=1 |
|
190 | #define RMAP_WRITE_PACKET_MIN_SZ(bytesCnt) (RMAP_WRITE_HEADER_MIN_SZ+bytesCnt+1) //header=16 + data + data CRC=1 | |
191 |
|
191 | |||
192 | inline void RMAP_build_tx_request_header(char destinationLogicalAddress, char destKey,char sourceLogicalAddress,uint16_t transactionID,int readAddress,int length,char *buffer) |
|
192 | inline void RMAP_build_tx_request_header(char destinationLogicalAddress, char destKey,char sourceLogicalAddress,uint16_t transactionID,int readAddress,int length,char *buffer) | |
193 | { |
|
193 | { | |
194 | buffer[0] = destinationLogicalAddress; |
|
194 | buffer[0] = destinationLogicalAddress; | |
195 | buffer[1] = SPW_PROTO_ID_RMAP; |
|
195 | buffer[1] = SPW_PROTO_ID_RMAP; | |
196 | buffer[2] = 0b01101100; |
|
196 | buffer[2] = 0b01101100; | |
197 | buffer[3] = destKey; |
|
197 | buffer[3] = destKey; | |
198 | buffer[4] = sourceLogicalAddress; |
|
198 | buffer[4] = sourceLogicalAddress; | |
199 | buffer[5] = (char)(transactionID >> 8); |
|
199 | buffer[5] = (char)(transactionID >> 8); | |
200 | buffer[6] = (char)(transactionID); |
|
200 | buffer[6] = (char)(transactionID); | |
201 | buffer[7] = 0; |
|
201 | buffer[7] = 0; | |
202 | buffer[8] = (char)(readAddress >> 24); |
|
202 | buffer[8] = (char)(readAddress >> 24); | |
203 | buffer[9] = (char)(readAddress >> 16); |
|
203 | buffer[9] = (char)(readAddress >> 16); | |
204 | buffer[10] = (char)(readAddress >> 8); |
|
204 | buffer[10] = (char)(readAddress >> 8); | |
205 | buffer[11] = (char)(readAddress); |
|
205 | buffer[11] = (char)(readAddress); | |
206 | buffer[12] = (char)(length >> 16); |
|
206 | buffer[12] = (char)(length >> 16); | |
207 | buffer[13] = (char)(length >> 8); |
|
207 | buffer[13] = (char)(length >> 8); | |
208 | buffer[14] = (char)(length); |
|
208 | buffer[14] = (char)(length); | |
209 | buffer[15] = (char)spw_CRC(buffer,15); |
|
209 | buffer[15] = (char)spw_CRC(buffer,15); | |
210 | buffer[16+length] = (char)spw_CRC(buffer+16,length); |
|
210 | buffer[16+length] = (char)spw_CRC(buffer+16,length); | |
211 | } |
|
211 | } | |
212 |
|
212 | |||
213 | #endif // SPW_H |
|
213 | #endif // SPW_H |
@@ -1,103 +1,112 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
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 | |||
27 | spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true) |
|
27 | spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true) | |
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->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this); |
|
32 | this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this); | |
33 | this->bridgeSelector = new QComboBox(this); |
|
33 | this->bridgeSelector = new QComboBox(this); | |
34 | this->mainLayout = new QGridLayout(this); |
|
34 | this->mainLayout = new QGridLayout(this); | |
35 | this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter); |
|
35 | this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter); | |
36 | this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1); |
|
36 | this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1); | |
37 | this->mainGroupBox->setLayout(this->mainLayout); |
|
37 | this->mainGroupBox->setLayout(this->mainLayout); | |
38 | this->setWidget(this->mainGroupBox); |
|
38 | this->setWidget(this->mainGroupBox); | |
39 | this->bridgeSelector->addItem("none"); |
|
39 | this->bridgeSelector->addItem("none"); | |
40 | this->bridgeSelector->addItem("STAR-Dundee Spw USB Brick"); |
|
40 | this->bridgeSelector->addItem("STAR-Dundee Spw USB Brick"); | |
41 | connect(this->bridgeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(bridgeSelectionChanged(QString))); |
|
41 | connect(this->bridgeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(bridgeSelectionChanged(QString))); | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | spwplugin::~spwplugin() |
|
45 | spwplugin::~spwplugin() | |
46 | { |
|
46 | { | |
47 |
|
47 | |||
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 |
|
50 | |||
51 |
|
51 | |||
52 | unsigned int spwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
52 | unsigned int spwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) | |
53 | { |
|
53 | { | |
54 | if(Connected) |
|
54 | if(Connected) | |
55 | { |
|
55 | { | |
56 | return bridge->Read(Value,count,address); |
|
56 | return bridge->Read(Value,count,address); | |
57 | } |
|
57 | } | |
58 | return 0; |
|
58 | return 0; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | void spwplugin::bridgeSelectionChanged(const QString &text) |
|
61 | void spwplugin::bridgeSelectionChanged(const QString &text) | |
62 | { |
|
62 | { | |
63 | printf("test"); |
|
63 | printf("test"); | |
64 | if(text=="none") |
|
64 | if(text=="none") | |
65 | { |
|
65 | { | |
66 | if(this->bridge!=NULL) |
|
66 | if(this->bridge!=NULL) | |
67 | { |
|
67 | { | |
68 | this->mainLayout->removeWidget(this->bridge->getGUI()); |
|
68 | this->mainLayout->removeWidget(this->bridge->getGUI()); | |
|
69 | this->disconnect(this,SLOT(setConnected(bool))); | |||
69 | delete this->bridge; |
|
70 | delete this->bridge; | |
70 | this->bridge= NULL; |
|
71 | this->bridge= NULL; | |
71 | } |
|
72 | } | |
72 | } |
|
73 | } | |
73 | if(text=="STAR-Dundee Spw USB Brick") |
|
74 | if(text=="STAR-Dundee Spw USB Brick") | |
74 | { |
|
75 | { | |
75 | if(this->bridge!=NULL) |
|
76 | if(this->bridge!=NULL) | |
76 | { |
|
77 | { | |
77 | this->mainLayout->removeWidget(this->bridge->getGUI()); |
|
78 | this->mainLayout->removeWidget(this->bridge->getGUI()); | |
|
79 | this->disconnect(this,SLOT(setConnected(bool))); | |||
78 | delete this->bridge; |
|
80 | delete this->bridge; | |
79 | } |
|
81 | } | |
80 | this->bridge = new stardundeeSPW_USB(this); |
|
82 | this->bridge = new stardundeeSPW_USB(this); | |
81 | this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2); |
|
83 | this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2); | |
|
84 | connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool))); | |||
|
85 | } | |||
|
86 | ||||
82 | } |
|
87 | } | |
83 |
|
88 | |||
|
89 | void spwplugin::setConnected(bool connected) | |||
|
90 | { | |||
|
91 | this->Connected = connected; | |||
|
92 | emit activateSig(connected); | |||
84 | } |
|
93 | } | |
85 |
|
94 | |||
86 |
|
95 | |||
87 |
|
96 | |||
88 | unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) |
|
97 | unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) | |
89 | { |
|
98 | { | |
90 | if(Connected) |
|
99 | if(Connected) | |
91 | { |
|
100 | { | |
92 | return bridge->Write(Value,count,address); |
|
101 | return bridge->Write(Value,count,address); | |
93 | } |
|
102 | } | |
94 | return 0; |
|
103 | return 0; | |
95 | } |
|
104 | } | |
96 |
|
105 | |||
97 |
|
106 | |||
98 |
|
107 | |||
99 |
|
108 | |||
100 |
|
109 | |||
101 |
|
110 | |||
102 |
|
111 | |||
103 |
|
112 |
@@ -1,70 +1,71 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef spwplugin_H |
|
22 | #ifndef spwplugin_H | |
23 | #define spwplugin_H |
|
23 | #define spwplugin_H | |
24 | #include <QMenuBar> |
|
24 | #include <QMenuBar> | |
25 | #include <QMenu> |
|
25 | #include <QMenu> | |
26 | #include <QAction> |
|
26 | #include <QAction> | |
27 | #include <QLayout> |
|
27 | #include <QLayout> | |
28 | #include <QGroupBox> |
|
28 | #include <QGroupBox> | |
29 | #include <QComboBox> |
|
29 | #include <QComboBox> | |
30 | #include <QLabel> |
|
30 | #include <QLabel> | |
31 |
|
31 | |||
32 | #include <abstractspwbridge.h> |
|
32 | #include <abstractspwbridge.h> | |
33 | #include <socexplorerplugin.h> |
|
33 | #include <socexplorerplugin.h> | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | class spwplugin : public socexplorerplugin |
|
36 | class spwplugin : public socexplorerplugin | |
37 | { |
|
37 | { | |
38 | Q_OBJECT |
|
38 | Q_OBJECT | |
39 | public: |
|
39 | public: | |
40 | explicit spwplugin(QWidget *parent = 0); |
|
40 | explicit spwplugin(QWidget *parent = 0); | |
41 | ~spwplugin(); |
|
41 | ~spwplugin(); | |
42 | /* You can implement the folowing function if you want to overwrite |
|
42 | /* You can implement the folowing function if you want to overwrite | |
43 | * their default behavior |
|
43 | * their default behavior | |
44 | */ |
|
44 | */ | |
45 | /* |
|
45 | /* | |
46 | int registermenu(QMainWindow *menuHolder); |
|
46 | int registermenu(QMainWindow *menuHolder); | |
47 | int isConnected(); |
|
47 | int isConnected(); | |
48 | int connect(); |
|
48 | int connect(); | |
49 | int VID(){return driver_VID;} |
|
49 | int VID(){return driver_VID;} | |
50 | int PID(){return driver_PID;} |
|
50 | int PID(){return driver_PID;} | |
51 | */ |
|
51 | */ | |
52 |
|
52 | |||
53 | public slots: |
|
53 | public slots: | |
54 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
54 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); | |
55 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
55 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
56 |
|
56 | |||
57 |
void |
|
57 | void bridgeSelectionChanged( const QString & text ); | |
|
58 | void setConnected(bool connected); | |||
58 |
|
59 | |||
59 | signals: |
|
60 | signals: | |
60 |
|
61 | |||
61 | private: |
|
62 | private: | |
62 | abstractSpwBridge* bridge; |
|
63 | abstractSpwBridge* bridge; | |
63 | bool scanDone; |
|
64 | bool scanDone; | |
64 | QGroupBox* mainGroupBox; |
|
65 | QGroupBox* mainGroupBox; | |
65 | QComboBox* bridgeSelector; |
|
66 | QComboBox* bridgeSelector; | |
66 | QGridLayout* mainLayout; |
|
67 | QGridLayout* mainLayout; | |
67 | }; |
|
68 | }; | |
68 |
|
69 | |||
69 | #endif // spwplugin_H |
|
70 | #endif // spwplugin_H | |
70 |
|
71 |
@@ -1,104 +1,144 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <ui version="4.0"> |
|
2 | <ui version="4.0"> | |
3 | <class>StarDundeeUI</class> |
|
3 | <class>StarDundeeUI</class> | |
4 | <widget class="QWidget" name="StarDundeeUI"> |
|
4 | <widget class="QWidget" name="StarDundeeUI"> | |
5 | <property name="geometry"> |
|
5 | <property name="geometry"> | |
6 | <rect> |
|
6 | <rect> | |
7 | <x>0</x> |
|
7 | <x>0</x> | |
8 | <y>0</y> |
|
8 | <y>0</y> | |
9 |
<width>6 |
|
9 | <width>645</width> | |
10 |
<height> |
|
10 | <height>231</height> | |
11 | </rect> |
|
11 | </rect> | |
12 | </property> |
|
12 | </property> | |
13 | <property name="windowTitle"> |
|
13 | <property name="windowTitle"> | |
14 | <string>Form</string> |
|
14 | <string>Form</string> | |
15 | </property> |
|
15 | </property> | |
16 | <layout class="QFormLayout" name="formLayout"> |
|
16 | <layout class="QFormLayout" name="formLayout"> | |
17 | <property name="fieldGrowthPolicy"> |
|
17 | <property name="fieldGrowthPolicy"> | |
18 | <enum>QFormLayout::AllNonFixedFieldsGrow</enum> |
|
18 | <enum>QFormLayout::AllNonFixedFieldsGrow</enum> | |
19 | </property> |
|
19 | </property> | |
20 | <item row="0" column="0"> |
|
20 | <item row="0" column="0"> | |
21 | <widget class="QLabel" name="selectBrickLbl"> |
|
21 | <widget class="QLabel" name="selectBrickLbl"> | |
22 | <property name="text"> |
|
22 | <property name="text"> | |
23 | <string>Select Brick</string> |
|
23 | <string>Select Brick</string> | |
24 | </property> |
|
24 | </property> | |
25 | </widget> |
|
25 | </widget> | |
26 | </item> |
|
26 | </item> | |
27 | <item row="0" column="1"> |
|
27 | <item row="0" column="1"> | |
28 | <widget class="QComboBox" name="selectBrickCmbx"> |
|
28 | <widget class="QComboBox" name="selectBrickCmbx"> | |
29 | <item> |
|
29 | <item> | |
30 | <property name="text"> |
|
30 | <property name="text"> | |
31 | <string>None</string> |
|
31 | <string>None</string> | |
32 | </property> |
|
32 | </property> | |
33 | </item> |
|
33 | </item> | |
34 | </widget> |
|
34 | </widget> | |
35 | </item> |
|
35 | </item> | |
36 | <item row="1" column="0"> |
|
36 | <item row="1" column="0"> | |
37 | <widget class="QLabel" name="selectLinkLbl"> |
|
37 | <widget class="QLabel" name="selectLinkLbl"> | |
38 | <property name="text"> |
|
38 | <property name="text"> | |
39 | <string>Select link number</string> |
|
39 | <string>Select link number</string> | |
40 | </property> |
|
40 | </property> | |
41 | </widget> |
|
41 | </widget> | |
42 | </item> |
|
42 | </item> | |
43 | <item row="1" column="1"> |
|
43 | <item row="1" column="1"> | |
44 | <widget class="QComboBox" name="selectLinkCmbx"> |
|
44 | <widget class="QComboBox" name="selectLinkCmbx"> | |
45 | <item> |
|
45 | <item> | |
46 | <property name="text"> |
|
46 | <property name="text"> | |
47 | <string>1</string> |
|
47 | <string>1</string> | |
48 | </property> |
|
48 | </property> | |
49 | </item> |
|
49 | </item> | |
50 | <item> |
|
50 | <item> | |
51 | <property name="text"> |
|
51 | <property name="text"> | |
52 | <string>2</string> |
|
52 | <string>2</string> | |
53 | </property> |
|
53 | </property> | |
54 | </item> |
|
54 | </item> | |
55 | </widget> |
|
55 | </widget> | |
56 | </item> |
|
56 | </item> | |
57 | <item row="2" column="0"> |
|
57 | <item row="2" column="0"> | |
58 | <widget class="QLabel" name="selectLinkSpeedLbl"> |
|
58 | <widget class="QLabel" name="selectLinkSpeedLbl"> | |
59 | <property name="text"> |
|
59 | <property name="text"> | |
60 | <string>Link Speed</string> |
|
60 | <string>Link Speed</string> | |
61 | </property> |
|
61 | </property> | |
62 | </widget> |
|
62 | </widget> | |
63 | </item> |
|
63 | </item> | |
64 | <item row="2" column="1"> |
|
64 | <item row="2" column="1"> | |
65 | <widget class="QComboBox" name="setLinkSpeedCmbx"> |
|
65 | <widget class="QComboBox" name="setLinkSpeedCmbx"> | |
66 | <item> |
|
66 | <item> | |
67 | <property name="text"> |
|
67 | <property name="text"> | |
68 | <string>10MHz</string> |
|
68 | <string>10MHz</string> | |
69 | </property> |
|
69 | </property> | |
70 | </item> |
|
70 | </item> | |
71 | </widget> |
|
71 | </widget> | |
72 | </item> |
|
72 | </item> | |
73 | <item row="3" column="0"> |
|
73 | <item row="3" column="0"> | |
74 | <widget class="QLabel" name="setDestKeyLbl"> |
|
74 | <widget class="QLabel" name="setDestKeyLbl"> | |
75 | <property name="text"> |
|
75 | <property name="text"> | |
76 | <string>Destination key</string> |
|
76 | <string>Destination key</string> | |
77 | </property> |
|
77 | </property> | |
78 | </widget> |
|
78 | </widget> | |
79 | </item> |
|
79 | </item> | |
80 | <item row="3" column="1"> |
|
80 | <item row="3" column="1"> | |
81 | <widget class="QLineEdit" name="destKeyLineEdit"> |
|
81 | <widget class="QLineEdit" name="destKeyLineEdit"> | |
82 | <property name="inputMask"> |
|
82 | <property name="inputMask"> | |
83 |
<string comment=" |
|
83 | <string comment="ddD"/> | |
84 | </property> |
|
84 | </property> | |
85 | <property name="text"> |
|
85 | <property name="text"> | |
86 | <string>32</string> |
|
86 | <string>32</string> | |
87 | </property> |
|
87 | </property> | |
88 | <property name="maxLength"> |
|
88 | <property name="maxLength"> | |
89 | <number>3</number> |
|
89 | <number>3</number> | |
90 | </property> |
|
90 | </property> | |
91 | </widget> |
|
91 | </widget> | |
92 | </item> |
|
92 | </item> | |
|
93 | <item row="4" column="0"> | |||
|
94 | <widget class="QLabel" name="RMAPaddressLbl"> | |||
|
95 | <property name="text"> | |||
|
96 | <string>RMAP Target address</string> | |||
|
97 | </property> | |||
|
98 | </widget> | |||
|
99 | </item> | |||
93 | <item row="4" column="1"> |
|
100 | <item row="4" column="1"> | |
94 |
<widget class="Q |
|
101 | <widget class="QLineEdit" name="RMAPAddresslineEdit"> | |
|
102 | <property name="inputMask"> | |||
|
103 | <string comment="ddD"/> | |||
|
104 | </property> | |||
|
105 | <property name="text"> | |||
|
106 | <string>254</string> | |||
|
107 | </property> | |||
|
108 | <property name="maxLength"> | |||
|
109 | <number>3</number> | |||
|
110 | </property> | |||
|
111 | </widget> | |||
|
112 | </item> | |||
|
113 | <item row="5" column="0"> | |||
|
114 | <widget class="QLabel" name="RMAPKeyLbl"> | |||
|
115 | <property name="text"> | |||
|
116 | <string>RMAP Target key</string> | |||
|
117 | </property> | |||
|
118 | </widget> | |||
|
119 | </item> | |||
|
120 | <item row="5" column="1"> | |||
|
121 | <widget class="QLineEdit" name="RMAPKeylineEdit"> | |||
|
122 | <property name="inputMask"> | |||
|
123 | <string comment="ddD"/> | |||
|
124 | </property> | |||
|
125 | <property name="text"> | |||
|
126 | <string comment="ddD">2</string> | |||
|
127 | </property> | |||
|
128 | <property name="maxLength"> | |||
|
129 | <number>3</number> | |||
|
130 | </property> | |||
|
131 | </widget> | |||
|
132 | </item> | |||
|
133 | <item row="6" column="1"> | |||
|
134 | <widget class="QPushButton" name="connectQpb"> | |||
95 | <property name="text"> |
|
135 | <property name="text"> | |
96 | <string>Connect</string> |
|
136 | <string>Connect</string> | |
97 | </property> |
|
137 | </property> | |
98 | </widget> |
|
138 | </widget> | |
99 | </item> |
|
139 | </item> | |
100 | </layout> |
|
140 | </layout> | |
101 | </widget> |
|
141 | </widget> | |
102 | <resources/> |
|
142 | <resources/> | |
103 | <connections/> |
|
143 | <connections/> | |
104 | </ui> |
|
144 | </ui> |
@@ -1,9 +1,98 | |||||
|
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 "stardundeegui.h" |
|
22 | #include "stardundeegui.h" | |
2 |
|
23 | |||
3 | #include "ui_stardundeeGUI.h" |
|
24 | #include "ui_stardundeeGUI.h" | |
4 |
|
25 | |||
5 | StarDundeeGUI::StarDundeeGUI(QWidget *parent) : |
|
26 | StarDundeeGUI::StarDundeeGUI(QWidget *parent) : | |
6 | QWidget(parent),ui(new Ui::StarDundeeUI) |
|
27 | QWidget(parent),ui(new Ui::StarDundeeUI) | |
7 | { |
|
28 | { | |
8 | this->ui->setupUi(this); |
|
29 | this->ui->setupUi(this); | |
|
30 | connect(this->ui->selectBrickCmbx,SIGNAL(currentIndexChanged(int)),this,SIGNAL(brickSelectionChanged(int))); | |||
|
31 | connect(this->ui->selectLinkCmbx,SIGNAL(currentIndexChanged(int)),this,SIGNAL(linkNumberSelectionChanged(int))); | |||
|
32 | connect(this->ui->setLinkSpeedCmbx,SIGNAL(currentIndexChanged(QString)),this,SIGNAL(linkSpeedSelectionChanged(QString))); | |||
|
33 | connect(this->ui->destKeyLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(destinationKeyChanged(QString))); | |||
|
34 | connect(this->ui->RMAPAddresslineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapAddressChanged(QString))); | |||
|
35 | connect(this->ui->RMAPKeylineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapKeyChanged(QString))); | |||
|
36 | connect(this->ui->connectQpb,SIGNAL(clicked()),this,SIGNAL(connectClicked())); | |||
|
37 | ||||
9 | } |
|
38 | } | |
|
39 | ||||
|
40 | int StarDundeeGUI::getBrickSelection() | |||
|
41 | { | |||
|
42 | return ui->selectBrickCmbx->currentIndex(); | |||
|
43 | } | |||
|
44 | ||||
|
45 | int StarDundeeGUI::getLinkNumberSelection() | |||
|
46 | { | |||
|
47 | return ui->selectLinkCmbx->currentIndex(); | |||
|
48 | } | |||
|
49 | ||||
|
50 | QString StarDundeeGUI::getLinkSpeedSelection() | |||
|
51 | { | |||
|
52 | return ui->setLinkSpeedCmbx->currentText(); | |||
|
53 | } | |||
|
54 | ||||
|
55 | QString StarDundeeGUI::getDestinationKey() | |||
|
56 | { | |||
|
57 | return ui->destKeyLineEdit->text(); | |||
|
58 | } | |||
|
59 | ||||
|
60 | QString StarDundeeGUI::getRmapAddress() | |||
|
61 | { | |||
|
62 | return ui->RMAPAddresslineEdit->text(); | |||
|
63 | } | |||
|
64 | ||||
|
65 | QString StarDundeeGUI::getRmapKey() | |||
|
66 | { | |||
|
67 | return ui->RMAPKeylineEdit->text(); | |||
|
68 | } | |||
|
69 | ||||
|
70 | ||||
|
71 | ||||
|
72 | void StarDundeeGUI::lock(bool lock) | |||
|
73 | { | |||
|
74 | this->ui->selectBrickCmbx->setDisabled(lock); | |||
|
75 | this->ui->selectLinkCmbx->setDisabled(lock); | |||
|
76 | this->ui->setLinkSpeedCmbx->setDisabled(lock); | |||
|
77 | this->ui->destKeyLineEdit->setDisabled(lock); | |||
|
78 | this->ui->RMAPAddresslineEdit->setDisabled(lock); | |||
|
79 | this->ui->RMAPKeylineEdit->setDisabled(lock); | |||
|
80 | if(lock) | |||
|
81 | this->ui->connectQpb->setText("Disconnect"); | |||
|
82 | else | |||
|
83 | this->ui->connectQpb->setText("Connect"); | |||
|
84 | } | |||
|
85 | ||||
|
86 | void StarDundeeGUI::updateAvailableBrickCount(int count) | |||
|
87 | { | |||
|
88 | this->ui->selectBrickCmbx->clear(); | |||
|
89 | this->ui->selectBrickCmbx->addItem("none"); | |||
|
90 | for(int i =0;i<32;i++) | |||
|
91 | { | |||
|
92 | if((count&1)==1) | |||
|
93 | { | |||
|
94 | this->ui->selectBrickCmbx->addItem("STAR-Dundee USB brick "+QString::number(i)); | |||
|
95 | } | |||
|
96 | count>>=1; | |||
|
97 | } | |||
|
98 | } |
@@ -1,24 +1,58 | |||||
|
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 STARDUNDEEGUI_H |
|
22 | #ifndef STARDUNDEEGUI_H | |
2 | #define STARDUNDEEGUI_H |
|
23 | #define STARDUNDEEGUI_H | |
3 |
|
24 | |||
4 | #include <QWidget> |
|
25 | #include <QWidget> | |
5 |
|
26 | |||
6 | namespace Ui { |
|
27 | namespace Ui { | |
7 | class StarDundeeUI; |
|
28 | class StarDundeeUI; | |
8 | } |
|
29 | } | |
9 |
|
30 | |||
10 | class StarDundeeGUI : public QWidget |
|
31 | class StarDundeeGUI : public QWidget | |
11 | { |
|
32 | { | |
12 | Q_OBJECT |
|
33 | Q_OBJECT | |
13 | public: |
|
34 | public: | |
14 | explicit StarDundeeGUI(QWidget *parent = 0); |
|
35 | explicit StarDundeeGUI(QWidget *parent = 0); | |
15 |
|
36 | int getBrickSelection(); | ||
|
37 | int getLinkNumberSelection(); | |||
|
38 | QString getLinkSpeedSelection(); | |||
|
39 | QString getDestinationKey(); | |||
|
40 | QString getRmapAddress(); | |||
|
41 | QString getRmapKey(); | |||
16 | signals: |
|
42 | signals: | |
17 |
|
43 | void brickSelectionChanged(int brickIndex); | ||
|
44 | void linkNumberSelectionChanged(int linkIndex); | |||
|
45 | void linkSpeedSelectionChanged(const QString & linkSpeed); | |||
|
46 | void destinationKeyChanged(const QString & destKey); | |||
|
47 | void rmapAddressChanged(const QString & address); | |||
|
48 | void rmapKeyChanged(const QString & key); | |||
|
49 | void connectClicked(); | |||
18 | public slots: |
|
50 | public slots: | |
|
51 | void lock(bool lock); | |||
|
52 | void updateAvailableBrickCount(int count); | |||
19 |
|
53 | |||
20 | private: |
|
54 | private: | |
21 | Ui::StarDundeeUI *ui; |
|
55 | Ui::StarDundeeUI *ui; | |
22 | }; |
|
56 | }; | |
23 |
|
57 | |||
24 | #endif // STARDUNDEEGUI_H |
|
58 | #endif // STARDUNDEEGUI_H |
@@ -1,522 +1,605 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #include "stardundeespw_usb.h" |
|
23 | #include "stardundeespw_usb.h" | |
24 | #include <socexplorerengine.h> |
|
24 | #include <socexplorerengine.h> | |
25 | #include <qhexedit.h> |
|
25 | #include <qhexedit.h> | |
26 |
|
26 | |||
27 | stardundeeSPW_USB::stardundeeSPW_USB(socexplorerplugin *parent) : |
|
27 | stardundeeSPW_USB::stardundeeSPW_USB(socexplorerplugin *parent) : | |
28 | abstractSpwBridge(parent) |
|
28 | abstractSpwBridge(parent) | |
29 | { |
|
29 | { | |
30 | Q_UNUSED(parent) |
|
30 | Q_UNUSED(parent) | |
31 | this->manager = new stardundeeSPW_USB_Manager(parent,this); |
|
31 | this->manager = new stardundeeSPW_USB_Manager(parent,this); | |
32 | makeGUI(parent); |
|
32 | makeGUI(parent); | |
33 | this->manager->start(); |
|
33 | this->manager->start(); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | stardundeeSPW_USB::~stardundeeSPW_USB() |
|
36 | stardundeeSPW_USB::~stardundeeSPW_USB() | |
37 | { |
|
37 | { | |
38 | this->manager->requestInterruption(); |
|
38 | this->manager->requestInterruption(); | |
39 | delete this->p_GUI; |
|
39 | delete this->p_GUI; | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void stardundeeSPW_USB::toggleBridgeConnection() |
|
42 | void stardundeeSPW_USB::toggleBridgeConnection() | |
43 | { |
|
43 | { | |
44 | if(this->plugin->isConnected()) |
|
44 | if(this->plugin->isConnected()) | |
45 | { |
|
45 | { | |
46 | if(this->disconnectBridge()) |
|
46 | if(this->disconnectBridge()) | |
47 | { |
|
47 | { | |
48 | this->connectBridgeButton->setText("Connect"); |
|
48 | ((StarDundeeGUI*)this->p_GUI)->lock(false); | |
|
49 | emit setConnected(false); | |||
49 | } |
|
50 | } | |
50 | } |
|
51 | } | |
51 | else |
|
52 | else | |
52 | { |
|
53 | { | |
53 | if(this->connectBridge()) |
|
54 | if(this->connectBridge()) | |
54 | { |
|
55 | { | |
55 | this->connectBridgeButton->setText("Disconnect"); |
|
56 | ((StarDundeeGUI*)this->p_GUI)->lock(true); | |
|
57 | emit setConnected(true); | |||
56 | } |
|
58 | } | |
57 | } |
|
59 | } | |
58 | } |
|
60 | } | |
59 |
|
61 | |||
60 | bool stardundeeSPW_USB::connectBridge() |
|
62 | bool stardundeeSPW_USB::connectBridge() | |
61 | { |
|
63 | { | |
62 | return this->manager->connectBridge(); |
|
64 | return this->manager->connectBridge(); | |
63 | } |
|
65 | } | |
64 |
|
66 | |||
65 | bool stardundeeSPW_USB::disconnectBridge() |
|
67 | bool stardundeeSPW_USB::disconnectBridge() | |
66 | { |
|
68 | { | |
67 | return this->manager->disconnectBridge(); |
|
69 | return this->manager->disconnectBridge(); | |
68 | } |
|
70 | } | |
69 |
|
71 | |||
70 | int stardundeeSPW_USB::pushRMAPPacket(char *packet, int size) |
|
72 | int stardundeeSPW_USB::pushRMAPPacket(char *packet, int size) | |
71 | { |
|
73 | { | |
72 | return this->manager->sendPacket(packet,size); |
|
74 | return this->manager->sendPacket(packet,size); | |
73 | } |
|
75 | } | |
74 |
|
76 | |||
75 | unsigned int stardundeeSPW_USB::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
77 | unsigned int stardundeeSPW_USB::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
76 | { |
|
78 | { | |
77 | char writeBuffer[RMAP_WRITE_PACKET_MIN_SZ((RMAP_MAX_XFER_SIZE*4))+1]; |
|
79 | char writeBuffer[RMAP_WRITE_PACKET_MIN_SZ((RMAP_MAX_XFER_SIZE*4))+1]; | |
78 |
writeBuffer[0]= |
|
80 | writeBuffer[0]=this->manager->linkNumber;//Link number | |
79 | int transactionID = 0; |
|
81 | int transactionID = 0; | |
80 | int written=0; |
|
82 | int written=0; | |
81 | SocExplorerEngine::message(this->plugin,"Enter Write function"); |
|
83 | SocExplorerEngine::message(this->plugin,"Enter Write function",2); | |
82 | QProgressBar* progress=NULL; |
|
84 | QProgressBar* progress=NULL; | |
83 | if(count>RMAP_MAX_XFER_SIZE) |
|
85 | if(count>RMAP_MAX_XFER_SIZE) | |
84 | progress= SocExplorerEngine::getProgressBar("Writing on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); |
|
86 | progress= SocExplorerEngine::getProgressBar("Writing on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); | |
85 | //Quite stupide loop, I guess that I always get the number of byte I asked for! |
|
87 | //Quite stupide loop, I guess that I always get the number of byte I asked for! | |
86 | while(count>=RMAP_MAX_XFER_SIZE) |
|
88 | while(count>=RMAP_MAX_XFER_SIZE) | |
87 | { |
|
89 | { | |
88 | for(int i=0;i<(RMAP_MAX_XFER_SIZE);i++) |
|
90 | for(int i=0;i<(RMAP_MAX_XFER_SIZE);i++) | |
89 | { |
|
91 | { | |
90 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+1] = (char)(((unsigned int)Value[i+written]>>24)&0xFF); |
|
92 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+1] = (char)(((unsigned int)Value[i+written]>>24)&0xFF); | |
91 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+2] = (char)(((unsigned int)Value[i+written]>>16)&0xFF); |
|
93 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+2] = (char)(((unsigned int)Value[i+written]>>16)&0xFF); | |
92 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+3] = (char)(((unsigned int)Value[i+written]>>8)&0xFF); |
|
94 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+3] = (char)(((unsigned int)Value[i+written]>>8)&0xFF); | |
93 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+4] = (char)(((unsigned int)Value[i+written])&0xFF); |
|
95 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+4] = (char)(((unsigned int)Value[i+written])&0xFF); | |
94 | } |
|
96 | } | |
95 |
RMAP_build_tx_request_header( |
|
97 | RMAP_build_tx_request_header(this->manager->rmapAddress,this->manager->rmapKey,1,transactionID,address+(written*4),RMAP_MAX_XFER_SIZE*4,writeBuffer+1); | |
96 | manager->sendPacket(writeBuffer,RMAP_WRITE_PACKET_MIN_SZ(RMAP_MAX_XFER_SIZE*4)+1); |
|
98 | manager->sendPacket(writeBuffer,RMAP_WRITE_PACKET_MIN_SZ(RMAP_MAX_XFER_SIZE*4)+1); | |
97 | written+=RMAP_MAX_XFER_SIZE; |
|
99 | written+=RMAP_MAX_XFER_SIZE; | |
98 | count-=RMAP_MAX_XFER_SIZE; |
|
100 | count-=RMAP_MAX_XFER_SIZE; | |
99 | progress->setValue(written); |
|
101 | progress->setValue(written); | |
100 | qApp->processEvents(); |
|
102 | qApp->processEvents(); | |
101 | } |
|
103 | } | |
102 | if(count>0) |
|
104 | if(count>0) | |
103 | { |
|
105 | { | |
104 | for(int i=0;i<((int)count);i++) |
|
106 | for(int i=0;i<((int)count);i++) | |
105 | { |
|
107 | { | |
106 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+1] = (char)(((unsigned int)Value[i+written]>>24)&0xFF); |
|
108 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+1] = (char)(((unsigned int)Value[i+written]>>24)&0xFF); | |
107 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+2] = (char)(((unsigned int)Value[i+written]>>16)&0xFF); |
|
109 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+2] = (char)(((unsigned int)Value[i+written]>>16)&0xFF); | |
108 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+3] = (char)(((unsigned int)Value[i+written]>>8)&0xFF); |
|
110 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+3] = (char)(((unsigned int)Value[i+written]>>8)&0xFF); | |
109 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+4] = (char)(((unsigned int)Value[i+written])&0xFF); |
|
111 | writeBuffer[RMAP_WRITE_HEADER_MIN_SZ+(i*4)+4] = (char)(((unsigned int)Value[i+written])&0xFF); | |
110 | } |
|
112 | } | |
111 |
RMAP_build_tx_request_header( |
|
113 | RMAP_build_tx_request_header(this->manager->rmapAddress,this->manager->rmapKey,1,transactionID,address+(written*4),count*4,writeBuffer+1); | |
112 | manager->sendPacket(writeBuffer,RMAP_WRITE_PACKET_MIN_SZ(count*4) +1); |
|
114 | manager->sendPacket(writeBuffer,RMAP_WRITE_PACKET_MIN_SZ(count*4) +1); | |
113 | written+=count; |
|
115 | written+=count; | |
114 | if(progress!=NULL) |
|
116 | if(progress!=NULL) | |
115 | { |
|
117 | { | |
116 | progress->setValue(written); |
|
118 | progress->setValue(written); | |
117 | qApp->processEvents(); |
|
119 | qApp->processEvents(); | |
118 | } |
|
120 | } | |
119 | } |
|
121 | } | |
120 | if(progress!=NULL) |
|
122 | if(progress!=NULL) | |
121 | { |
|
123 | { | |
122 | SocExplorerEngine::deleteProgressBar(progress); |
|
124 | SocExplorerEngine::deleteProgressBar(progress); | |
123 | } |
|
125 | } | |
124 | return written; |
|
126 | return written; | |
125 | } |
|
127 | } | |
126 |
|
128 | |||
127 | unsigned int stardundeeSPW_USB::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
129 | unsigned int stardundeeSPW_USB::Read(unsigned int *Value, unsigned int count, unsigned int address) | |
128 | { |
|
130 | { | |
129 | char requestBuffer[RMAP_READ_HEADER_MIN_SZ+1]; |
|
131 | char requestBuffer[RMAP_READ_HEADER_MIN_SZ+1]; | |
130 | char* RMAP_AnswerBuffer; |
|
132 | char* RMAP_AnswerBuffer; | |
131 |
requestBuffer[0]= |
|
133 | requestBuffer[0]=this->manager->linkNumber;//Link number | |
132 | int transactionID = 0; |
|
134 | int transactionID = 0; | |
133 | int read=0; |
|
135 | int read=0; | |
134 | QProgressBar* progress=NULL; |
|
136 | QProgressBar* progress=NULL; | |
135 | if(count>RMAP_MAX_XFER_SIZE) |
|
137 | if(count>RMAP_MAX_XFER_SIZE) | |
136 | progress= SocExplorerEngine::getProgressBar("Reading on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); |
|
138 | progress= SocExplorerEngine::getProgressBar("Reading on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); | |
137 | SocExplorerEngine::message(this->plugin,QString("Enter read function, count=%1, RMAP_MAX_XFER_SIZE=%2").arg(count).arg(RMAP_MAX_XFER_SIZE)); |
|
139 | SocExplorerEngine::message(this->plugin,QString("Enter read function, count=%1, RMAP_MAX_XFER_SIZE=%2").arg(count).arg(RMAP_MAX_XFER_SIZE),2); | |
138 |
|
140 | |||
139 | //Quite stupide loop, I guess that I always get the number of byte I asked for! |
|
141 | //Quite stupide loop, I guess that I always get the number of byte I asked for! | |
140 | while((int)count>=(int)RMAP_MAX_XFER_SIZE) |
|
142 | while((int)count>=(int)RMAP_MAX_XFER_SIZE) | |
141 | { |
|
143 | { | |
142 | transactionID = manager->getRMAPtransactionID(); |
|
144 | transactionID = manager->getRMAPtransactionID(); | |
143 | SocExplorerEngine::message(this->plugin,QString("New transactionID:%1").arg(transactionID)); |
|
145 | SocExplorerEngine::message(this->plugin,QString("New transactionID:%1").arg(transactionID),2); | |
144 |
RMAP_build_rx_request_header( |
|
146 | RMAP_build_rx_request_header(this->manager->rmapAddress,this->manager->rmapKey,1,transactionID,address+(read*4),RMAP_MAX_XFER_SIZE*4,requestBuffer+1); | |
145 | manager->sendPacket(requestBuffer,RMAP_READ_HEADER_MIN_SZ+1); |
|
147 | manager->sendPacket(requestBuffer,RMAP_READ_HEADER_MIN_SZ+1); | |
146 | int len=manager->getRMAPanswer(transactionID,&RMAP_AnswerBuffer); |
|
148 | int len=manager->getRMAPanswer(transactionID,&RMAP_AnswerBuffer); | |
|
149 | if(len==-1) | |||
|
150 | { | |||
|
151 | this->toggleBridgeConnection(); | |||
|
152 | return 0; | |||
|
153 | } | |||
147 | for(int i=0;i<((len-13)/4);i++) |
|
154 | for(int i=0;i<((len-13)/4);i++) | |
148 | { |
|
155 | { | |
149 | Value[read+i] = 0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+12]); |
|
156 | Value[read+i] = 0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+12]); | |
150 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+13])); |
|
157 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+13])); | |
151 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+14])); |
|
158 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+14])); | |
152 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+15])); |
|
159 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+15])); | |
153 | } |
|
160 | } | |
154 | free(RMAP_AnswerBuffer); |
|
161 | free(RMAP_AnswerBuffer); | |
155 | read+=RMAP_MAX_XFER_SIZE; |
|
162 | read+=RMAP_MAX_XFER_SIZE; | |
156 | count-=RMAP_MAX_XFER_SIZE; |
|
163 | count-=RMAP_MAX_XFER_SIZE; | |
157 | progress->setValue(read); |
|
164 | progress->setValue(read); | |
158 | qApp->processEvents(); |
|
165 | qApp->processEvents(); | |
159 | } |
|
166 | } | |
160 | if((int)count>0) |
|
167 | if((int)count>0) | |
161 | { |
|
168 | { | |
162 | transactionID = manager->getRMAPtransactionID(); |
|
169 | transactionID = manager->getRMAPtransactionID(); | |
163 | SocExplorerEngine::message(this->plugin,QString("New transactionID: %1").arg(transactionID)); |
|
170 | SocExplorerEngine::message(this->plugin,QString("New transactionID: %1").arg(transactionID),2); | |
164 | SocExplorerEngine::message(this->plugin,QString("Building request with:")); |
|
171 | SocExplorerEngine::message(this->plugin,QString("Building request with:"),2); | |
165 | SocExplorerEngine::message(this->plugin,QString("Address = %1").arg(address+(read*4),8,16)); |
|
172 | SocExplorerEngine::message(this->plugin,QString("Address = %1").arg(address+(read*4),8,16),2); | |
166 | SocExplorerEngine::message(this->plugin,QString("Size = %1").arg(count*4)); |
|
173 | SocExplorerEngine::message(this->plugin,QString("Size = %1").arg(count*4),2); | |
167 | SocExplorerEngine::message(this->plugin,QString("Size + 13 = %1").arg((count*4)+13)); |
|
174 | SocExplorerEngine::message(this->plugin,QString("Size + 13 = %1").arg((count*4)+13),2); | |
168 |
RMAP_build_rx_request_header( |
|
175 | RMAP_build_rx_request_header(this->manager->rmapAddress,this->manager->rmapKey,1,transactionID,address+(read*4),count*4,requestBuffer+1); | |
169 | manager->sendPacket(requestBuffer,RMAP_READ_HEADER_MIN_SZ+1); |
|
176 | manager->sendPacket(requestBuffer,RMAP_READ_HEADER_MIN_SZ+1); | |
170 | int len=manager->getRMAPanswer(transactionID,&RMAP_AnswerBuffer); |
|
177 | int len=manager->getRMAPanswer(transactionID,&RMAP_AnswerBuffer); | |
|
178 | if(len==-1) | |||
|
179 | { | |||
|
180 | this->toggleBridgeConnection(); | |||
|
181 | return 0; | |||
|
182 | } | |||
171 | for(int i=0;i<((len-13)/4);i++) |
|
183 | for(int i=0;i<((len-13)/4);i++) | |
172 | { |
|
184 | { | |
173 | Value[read+i] = 0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+12]); |
|
185 | Value[read+i] = 0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+12]); | |
174 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+13])); |
|
186 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+13])); | |
175 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+14])); |
|
187 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+14])); | |
176 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+15])); |
|
188 | Value[read+i] = (Value[read+i]<<8) + (0x0FF & ((unsigned int)RMAP_AnswerBuffer[(4*i)+15])); | |
177 | } |
|
189 | } | |
178 | free(RMAP_AnswerBuffer); |
|
190 | free(RMAP_AnswerBuffer); | |
179 | read+=count; |
|
191 | read+=count; | |
180 | if(progress!=NULL) |
|
192 | if(progress!=NULL) | |
181 | { |
|
193 | { | |
182 | progress->setValue(read); |
|
194 | progress->setValue(read); | |
183 | qApp->processEvents(); |
|
195 | qApp->processEvents(); | |
184 | } |
|
196 | } | |
185 | } |
|
197 | } | |
186 | if(progress!=NULL) |
|
198 | if(progress!=NULL) | |
187 | { |
|
199 | { | |
188 | SocExplorerEngine::deleteProgressBar(progress); |
|
200 | SocExplorerEngine::deleteProgressBar(progress); | |
189 | } |
|
201 | } | |
190 | return read; |
|
202 | return read; | |
191 | } |
|
203 | } | |
192 |
|
204 | |||
193 |
void stardundeeSPW_USB:: |
|
205 | void stardundeeSPW_USB::brickSelectionChanged(int brickIndex) | |
|
206 | { | |||
|
207 | this->manager->selectedBrick = brickIndex-1; | |||
|
208 | SocExplorerEngine::message(plugin,QString("Changing brick index: %1").arg(manager->selectedBrick)); | |||
|
209 | } | |||
|
210 | ||||
|
211 | void stardundeeSPW_USB::linkNumberSelectionChanged(int linkIndex) | |||
|
212 | { | |||
|
213 | this->manager->linkNumber = linkIndex + 1; | |||
|
214 | SocExplorerEngine::message(plugin,QString("Changing Link Number: %1").arg(manager->linkNumber)); | |||
|
215 | } | |||
|
216 | ||||
|
217 | void stardundeeSPW_USB::linkSpeedSelectionChanged(const QString &linkSpeed) | |||
194 | { |
|
218 | { | |
|
219 | this->manager->linkSpeed = linkSpeed.toInt(); | |||
195 |
|
220 | |||
|
221 | SocExplorerEngine::message(plugin,QString("Changing Link Speed: %1").arg(manager->linkSpeed)); | |||
|
222 | } | |||
|
223 | ||||
|
224 | void stardundeeSPW_USB::destinationKeyChanged(const QString &destKey) | |||
|
225 | { | |||
|
226 | this->manager->destinationKey = destKey.toInt(); | |||
|
227 | SocExplorerEngine::message(plugin,QString("Changing Destination Key: %1").arg(manager->destinationKey)); | |||
|
228 | } | |||
|
229 | ||||
|
230 | void stardundeeSPW_USB::rmapAddressChanged(const QString &rmapaddress) | |||
|
231 | { | |||
|
232 | this->manager->rmapAddress = rmapaddress.toInt(); | |||
|
233 | SocExplorerEngine::message(plugin,QString("Changing RMAP address: %1").arg(manager->rmapAddress)); | |||
|
234 | } | |||
|
235 | ||||
|
236 | void stardundeeSPW_USB::rmapKeyChanged(const QString &key) | |||
|
237 | { | |||
|
238 | this->manager->rmapKey = key.toInt(); | |||
|
239 | SocExplorerEngine::message(plugin,QString("Changing RMAP Key: %1").arg(manager->rmapKey)); | |||
196 | } |
|
240 | } | |
197 |
|
241 | |||
198 | void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent) |
|
242 | void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent) | |
199 | { |
|
243 | { | |
200 |
this->p_GUI = new StarDundeeGUI( |
|
244 | this->p_GUI = new StarDundeeGUI(); | |
201 | this->mainLayout = new QGridLayout(this->p_GUI); |
|
245 | // this->mainLayout = new QGridLayout(this->p_GUI); | |
202 |
|
|
246 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(connectClicked()),this,SLOT(toggleBridgeConnection())); | |
|
247 | connect(this->manager,SIGNAL(updateAvailableBrickCount(int)),((StarDundeeGUI*)this->p_GUI),SLOT(updateAvailableBrickCount(int))); | |||
|
248 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(brickSelectionChanged(int)),this,SLOT(brickSelectionChanged(int))); | |||
|
249 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(linkNumberSelectionChanged(int)),this,SLOT(linkNumberSelectionChanged(int))); | |||
|
250 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(linkSpeedSelectionChanged(QString)),this,SLOT(linkSpeedSelectionChanged(QString))); | |||
|
251 | 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))); | |||
|
253 | connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapKeyChanged(QString)),this,SLOT(rmapKeyChanged(QString))); | |||
|
254 | this->brickSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getBrickSelection()); | |||
|
255 | this->linkNumberSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkNumberSelection()); | |||
|
256 | this->linkSpeedSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkSpeedSelection()); | |||
|
257 | this->destinationKeyChanged(((StarDundeeGUI*)this->p_GUI)->getDestinationKey()); | |||
|
258 | this->rmapAddressChanged(((StarDundeeGUI*)this->p_GUI)->getRmapAddress()); | |||
|
259 | this->rmapKeyChanged(((StarDundeeGUI*)this->p_GUI)->getRmapKey()); | |||
|
260 | ||||
203 | } |
|
261 | } | |
204 |
|
262 | |||
205 | stardundeeSPW_USB_Manager::stardundeeSPW_USB_Manager(socexplorerplugin *plugin, QObject *parent) |
|
263 | stardundeeSPW_USB_Manager::stardundeeSPW_USB_Manager(socexplorerplugin *plugin, QObject *parent) | |
206 | :QThread((QObject*)parent) |
|
264 | :QThread((QObject*)parent) | |
207 | { |
|
265 | { | |
|
266 | this->RMAPtimeout = 2000; | |||
208 | this->handleMutex = new QMutex(QMutex::NonRecursive); |
|
267 | this->handleMutex = new QMutex(QMutex::NonRecursive); | |
209 | this->RMAP_AnswersSem = new QSemaphore(0); |
|
268 | this->RMAP_AnswersSem = new QSemaphore(0); | |
210 | this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive); |
|
269 | this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive); | |
211 | this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive); |
|
270 | this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive); | |
212 | this->plugin = plugin; |
|
271 | this->plugin = plugin; | |
213 | connected = false; |
|
272 | connected = false; | |
214 | } |
|
273 | } | |
215 |
|
274 | |||
216 | stardundeeSPW_USB_Manager::~stardundeeSPW_USB_Manager() |
|
275 | stardundeeSPW_USB_Manager::~stardundeeSPW_USB_Manager() | |
217 | { |
|
276 | { | |
218 | this->terminate(); |
|
277 | this->terminate(); | |
219 | while (!this->isFinished()) { |
|
278 | while (!this->isFinished()) { | |
220 | this->usleep(1000); |
|
279 | this->usleep(1000); | |
221 | } |
|
280 | } | |
222 | } |
|
281 | } | |
223 |
|
282 | |||
224 |
|
283 | |||
225 | void stardundeeSPW_USB_Manager::run() |
|
284 | void stardundeeSPW_USB_Manager::run() | |
226 | { |
|
285 | { | |
227 | USB_SPACEWIRE_PACKET_PROPERTIES properties; |
|
286 | USB_SPACEWIRE_PACKET_PROPERTIES properties; | |
228 | USB_SPACEWIRE_ID pIdentifier=NULL; |
|
287 | USB_SPACEWIRE_ID pIdentifier=NULL; | |
229 | USB_SPACEWIRE_STATUS stat; |
|
288 | USB_SPACEWIRE_STATUS stat; | |
230 | SocExplorerEngine::message(this->plugin,"Starting Startdundee USB pooling thread"); |
|
289 | SocExplorerEngine::message(this->plugin,"Starting Startdundee USB pooling thread",1); | |
231 | char buffer[(RMAP_MAX_XFER_SIZE*4)+50]; |
|
290 | char buffer[(RMAP_MAX_XFER_SIZE*4)+50]; | |
232 | while (!this->isInterruptionRequested()) |
|
291 | while (!this->isInterruptionRequested()) | |
233 | { |
|
292 | { | |
234 | if(this->connected) |
|
293 | if(this->connected) | |
235 | { |
|
294 | { | |
236 | handleMutex->lock(); |
|
295 | handleMutex->lock(); | |
237 | //SocExplorerEngine::message(this->plugin,"Looking for new RMAP packets"); |
|
296 | //SocExplorerEngine::message(this->plugin,"Looking for new RMAP packets"); | |
238 | if(USBSpaceWire_WaitOnReadPacketAvailable(hDevice,0.01)) |
|
297 | if(USBSpaceWire_WaitOnReadPacketAvailable(hDevice,0.01)) | |
239 | { |
|
298 | { | |
240 | SocExplorerEngine::message(this->plugin,"Got packet"); |
|
299 | SocExplorerEngine::message(this->plugin,"Got packet",2); | |
241 | stat = USBSpaceWire_ReadPackets(hDevice, buffer, (RMAP_MAX_XFER_SIZE*4)+50,1, 1, &properties, &pIdentifier); |
|
300 | stat = USBSpaceWire_ReadPackets(hDevice, buffer, (RMAP_MAX_XFER_SIZE*4)+50,1, 1, &properties, &pIdentifier); | |
242 | if (stat == TRANSFER_SUCCESS) |
|
301 | if (stat == TRANSFER_SUCCESS) | |
243 | { |
|
302 | { | |
244 | if(USBSpaceWire_GetReadTrafficType(&properties, 0) ==SPACEWIRE_TRAFFIC_PACKET) |
|
303 | if(USBSpaceWire_GetReadTrafficType(&properties, 0) ==SPACEWIRE_TRAFFIC_PACKET) | |
245 | { |
|
304 | { | |
246 | SocExplorerEngine::message(this->plugin,"It's a SPW packet"); |
|
305 | SocExplorerEngine::message(this->plugin,"It's a SPW packet",2); | |
247 | if(USBSpaceWire_GetReadEOPStatus(&properties, 0)== SPACEWIRE_USB_EOP) |
|
306 | if(USBSpaceWire_GetReadEOPStatus(&properties, 0)== SPACEWIRE_USB_EOP) | |
248 | { |
|
307 | { | |
249 | SocExplorerEngine::message(this->plugin,"Got end of packet"); |
|
308 | SocExplorerEngine::message(this->plugin,"Got end of packet"); | |
250 | if(buffer[1]==(char)SPW_PROTO_ID_RMAP) //RMAP packet |
|
309 | if(buffer[1]==(char)SPW_PROTO_ID_RMAP) //RMAP packet | |
251 | { |
|
310 | { | |
252 | SocExplorerEngine::message(this->plugin,"Got RMAP packet"); |
|
311 | SocExplorerEngine::message(this->plugin,"Got RMAP packet",2); | |
253 | SocExplorerEngine::message(this->plugin,QString("Rmap packet size %1").arg(properties.len)); |
|
312 | SocExplorerEngine::message(this->plugin,QString("Rmap packet size %1").arg(properties.len),2); | |
254 | if(properties.len>8) |
|
313 | if(properties.len>8) | |
255 | { |
|
314 | { | |
256 | char* packetbuffer = (char*)malloc(properties.len); |
|
315 | char* packetbuffer = (char*)malloc(properties.len); | |
257 | memcpy(packetbuffer,buffer,properties.len); |
|
316 | memcpy(packetbuffer,buffer,properties.len); | |
258 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
317 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
259 | pIdentifier = NULL; |
|
318 | pIdentifier = NULL; | |
260 | handleMutex->unlock(); |
|
319 | handleMutex->unlock(); | |
261 | RMAP_Answer* packet=new RMAP_Answer(RMAP_get_transactionID(buffer+1),packetbuffer,properties.len); |
|
320 | RMAP_Answer* packet=new RMAP_Answer(RMAP_get_transactionID(buffer+1),packetbuffer,properties.len); | |
262 | RMAP_AnswersMtx->lock(); |
|
321 | RMAP_AnswersMtx->lock(); | |
263 | RMAP_Answers.append(packet); |
|
322 | RMAP_Answers.append(packet); | |
264 | RMAP_AnswersMtx->unlock(); |
|
323 | RMAP_AnswersMtx->unlock(); | |
265 | RMAP_AnswersSem->release(); |
|
324 | RMAP_AnswersSem->release(); | |
266 |
|
325 | |||
267 | } |
|
326 | } | |
268 | else //it's a RMAP write response |
|
327 | else //it's a RMAP write response | |
269 | { |
|
328 | { | |
270 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
329 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
271 | pIdentifier = NULL; |
|
330 | pIdentifier = NULL; | |
272 | handleMutex->unlock(); |
|
331 | handleMutex->unlock(); | |
273 | } |
|
332 | } | |
274 |
|
333 | |||
275 | } |
|
334 | } | |
276 | else //any non-rmap packet will be pushed to the network |
|
335 | else //any non-rmap packet will be pushed to the network | |
277 | { |
|
336 | { | |
278 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
337 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
279 | handleMutex->unlock(); |
|
338 | handleMutex->unlock(); | |
280 | SocExplorerEngine::message(this->plugin,"Got SPW packet"); |
|
339 | SocExplorerEngine::message(this->plugin,"Got SPW packet",2); | |
281 | } |
|
340 | } | |
282 | } |
|
341 | } | |
283 | else |
|
342 | else | |
284 | { |
|
343 | { | |
285 | SocExplorerEngine::message(this->plugin,"No EOP received"); |
|
344 | SocExplorerEngine::message(this->plugin,"No EOP received",2); | |
286 | } |
|
345 | } | |
287 | } |
|
346 | } | |
288 |
|
347 | |||
289 | } |
|
348 | } | |
290 | else |
|
349 | else | |
291 | { |
|
350 | { | |
292 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
351 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
293 | handleMutex->unlock(); |
|
352 | handleMutex->unlock(); | |
294 | } |
|
353 | } | |
295 | } |
|
354 | } | |
296 | else |
|
355 | else | |
297 | { |
|
356 | { | |
298 | USBSpaceWire_FreeRead(hDevice, pIdentifier); |
|
357 | USBSpaceWire_FreeRead(hDevice, pIdentifier); | |
299 | handleMutex->unlock(); |
|
358 | handleMutex->unlock(); | |
300 | } |
|
359 | } | |
301 | } |
|
360 | } | |
302 | else |
|
361 | else | |
303 | { |
|
362 | { | |
304 | sleep(1); |
|
363 | sleep(1); | |
305 |
|
|
364 | int list = USBSpaceWire_ListDevices(); | |
|
365 | if(this->brickList!=list) | |||
|
366 | { | |||
|
367 | this->brickList = list; | |||
|
368 | emit updateAvailableBrickCount(this->brickList); | |||
|
369 | } | |||
306 | } |
|
370 | } | |
307 | usleep(1000); |
|
371 | usleep(1000); | |
308 | } |
|
372 | } | |
309 | SocExplorerEngine::message(this->plugin,"Exiting Startdundee USB pooling thread"); |
|
373 | SocExplorerEngine::message(this->plugin,"Exiting Startdundee USB pooling thread",1); | |
310 | } |
|
374 | } | |
311 |
|
375 | |||
312 | bool stardundeeSPW_USB_Manager::connectBridge() |
|
376 | bool stardundeeSPW_USB_Manager::connectBridge() | |
313 | { |
|
377 | { | |
314 |
this->handleMutex |
|
378 | QMutexLocker mlock(this->handleMutex); | |
315 | int status; |
|
379 | int status; | |
316 | U32 statusControl; |
|
380 | U32 statusControl; | |
317 | int brickNumber=0; |
|
|||
318 | int linkNumber=1; |
|
|||
319 | this->connected = false; |
|
381 | this->connected = false; | |
320 |
if (!USBSpaceWire_Open(&hDevice, |
|
382 | if (!USBSpaceWire_Open(&hDevice, this->selectedBrick)) // Open the USB device | |
321 | { |
|
383 | { | |
322 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); |
|
384 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))",0); | |
323 | this->handleMutex->unlock(); |
|
|||
324 | return false; |
|
385 | return false; | |
325 | } |
|
386 | } | |
326 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** USBSpaceWire_Open successful"); |
|
387 | SocExplorerEngine::message(this->plugin,"stardundee *** Open *** USBSpaceWire_Open successful",0); | |
327 |
|
388 | |||
328 | USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode |
|
389 | USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode | |
329 | CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP for the StarDundee brick configuration |
|
390 | CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP for the StarDundee brick configuration | |
330 | CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices |
|
391 | CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices | |
331 |
|
392 | |||
332 | // Set the path and return path to the device |
|
393 | // Set the path and return path to the device | |
333 | CFGSpaceWire_StackClear(); |
|
394 | CFGSpaceWire_StackClear(); | |
334 | CFGSpaceWire_AddrStackPush(0); |
|
395 | CFGSpaceWire_AddrStackPush(0); | |
335 | CFGSpaceWire_AddrStackPush(254); |
|
396 | CFGSpaceWire_AddrStackPush(254); | |
336 | CFGSpaceWire_RetAddrStackPush(254); |
|
397 | CFGSpaceWire_RetAddrStackPush(254); | |
337 | // set the base transmit rate to 100 MHz |
|
398 | // set the base transmit rate to 100 MHz | |
338 | status = CFGSpaceWire_SetBrickBaseTransmitRate( hDevice, CFG_BRK_CLK_100_MHZ, CFG_BRK_DVDR_1, 0xff); |
|
399 | status = CFGSpaceWire_SetBrickBaseTransmitRate( hDevice, CFG_BRK_CLK_100_MHZ, CFG_BRK_DVDR_1, 0xff); | |
339 | if (status != CFG_TRANSFER_SUCCESS) |
|
400 | if (status != CFG_TRANSFER_SUCCESS) | |
340 | { |
|
401 | { | |
341 | SocExplorerEngine::message(this->plugin,"ERROR CFGSpaceWire_SetBrickBaseTransmitRate"); |
|
402 | SocExplorerEngine::message(this->plugin,"ERROR CFGSpaceWire_SetBrickBaseTransmitRate",1); | |
342 | return false; |
|
403 | return false; | |
343 | } |
|
404 | } | |
344 | else |
|
405 | else | |
345 | { |
|
406 | { | |
346 | SocExplorerEngine::message(this->plugin,"OK CFGSpaceWire_SetBrickBaseTransmitRate, base rate = 100 MHz"); |
|
407 | SocExplorerEngine::message(this->plugin,"OK CFGSpaceWire_SetBrickBaseTransmitRate, base rate = 100 MHz",1); | |
347 | } |
|
408 | } | |
348 |
|
409 | |||
349 | // read the link status |
|
410 | // read the link status | |
350 | if (CFGSpaceWire_GetLinkStatusControl(hDevice, linkNumber, &statusControl) != CFG_TRANSFER_SUCCESS) |
|
411 | if (CFGSpaceWire_GetLinkStatusControl(hDevice, this->linkNumber, &statusControl) != CFG_TRANSFER_SUCCESS) | |
351 | { |
|
412 | { | |
352 | SocExplorerEngine::message(this->plugin,"Could not read link status control for link " + QString::number(linkNumber)); |
|
413 | SocExplorerEngine::message(this->plugin,"Could not read link status control for link " + QString::number(this->linkNumber),1); | |
353 | return false; |
|
414 | return false; | |
354 | } |
|
415 | } | |
355 | else |
|
416 | else | |
356 | { |
|
417 | { | |
357 | SocExplorerEngine::message(this->plugin,"OK CFGSpaceWire_GetLinkStatusControl of link " + QString::number(linkNumber)); |
|
418 | SocExplorerEngine::message(this->plugin,"OK CFGSpaceWire_GetLinkStatusControl of link " + QString::number(this->linkNumber),1); | |
358 |
|
419 | |||
359 | // Set the link status control register properties |
|
420 | // Set the link status control register properties | |
360 | CFGSpaceWire_LSEnableAutoStart(&statusControl, 1); |
|
421 | CFGSpaceWire_LSEnableAutoStart(&statusControl, 1); | |
361 | CFGSpaceWire_LSEnableStart(&statusControl, 1); |
|
422 | CFGSpaceWire_LSEnableStart(&statusControl, 1); | |
362 | CFGSpaceWire_LSEnableDisabled(&statusControl, 0); |
|
423 | CFGSpaceWire_LSEnableDisabled(&statusControl, 0); | |
363 | CFGSpaceWire_LSEnableTristate(&statusControl, 0); |
|
424 | CFGSpaceWire_LSEnableTristate(&statusControl, 0); | |
364 | CFGSpaceWire_LSSetOperatingSpeed(&statusControl, 9); // sets the link speed to ( 100 MHz / (9+1) ) = 10 MHz |
|
425 | CFGSpaceWire_LSSetOperatingSpeed(&statusControl, 9); // sets the link speed to ( 100 MHz / (9+1) ) = 10 MHz | |
365 |
|
426 | |||
366 | // Set the link status control register |
|
427 | // Set the link status control register | |
367 | if (CFGSpaceWire_SetLinkStatusControl(hDevice, linkNumber, statusControl) != CFG_TRANSFER_SUCCESS) |
|
428 | if (CFGSpaceWire_SetLinkStatusControl(hDevice, this->linkNumber, statusControl) != CFG_TRANSFER_SUCCESS) | |
368 | { |
|
429 | { | |
369 | SocExplorerEngine::message(this->plugin,"Could not set the link status control for link " + QString::number(linkNumber)); |
|
430 | SocExplorerEngine::message(this->plugin,"Could not set the link status control for link " + QString::number(this->linkNumber),1); | |
370 | return false; |
|
431 | return false; | |
371 | } |
|
432 | } | |
372 | else |
|
433 | else | |
373 | { |
|
434 | { | |
374 | SocExplorerEngine::message(this->plugin,"Set the link status control for link " + QString::number(linkNumber)); |
|
435 | SocExplorerEngine::message(this->plugin,"Set the link status control for link " + QString::number(this->linkNumber),1); | |
375 | } |
|
436 | } | |
376 | } |
|
437 | } | |
377 |
|
438 | |||
378 | if (CFGSpaceWire_SetAsInterface(hDevice, 1, 0) != CFG_TRANSFER_SUCCESS) |
|
439 | if (CFGSpaceWire_SetAsInterface(hDevice, 1, 0) != CFG_TRANSFER_SUCCESS) | |
379 | { |
|
440 | { | |
380 | SocExplorerEngine::message(this->plugin,"Could not set the device to be an interface"); |
|
441 | SocExplorerEngine::message(this->plugin,"Could not set the device to be an interface",1); | |
381 | return false; |
|
442 | return false; | |
382 | } |
|
443 | } | |
383 | else |
|
444 | else | |
384 | { |
|
445 | { | |
385 | SocExplorerEngine::message(this->plugin,"Device set to be an interface"); |
|
446 | SocExplorerEngine::message(this->plugin,"Device set to be an interface",1); | |
386 | } |
|
447 | } | |
387 |
|
448 | |||
388 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports |
|
449 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports | |
389 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints |
|
450 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints | |
390 | USBSpaceWire_SetTimeout(hDevice,1.0); |
|
451 | USBSpaceWire_SetTimeout(hDevice,1.0); | |
391 | SocExplorerEngine::message(this->plugin,"The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes"); |
|
452 | SocExplorerEngine::message(this->plugin,"The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes",1); | |
392 | SocExplorerEngine::message(this->plugin,"The driver's current read buffer size is " + QString::number(USBSpaceWire_GetDriverReadBufferSize(hDevice)) + " bytes"); |
|
453 | SocExplorerEngine::message(this->plugin,"The driver's current read buffer size is " + QString::number(USBSpaceWire_GetDriverReadBufferSize(hDevice)) + " bytes",1); | |
393 | SocExplorerEngine::message(this->plugin,"USBSpaceWire_IsReadThrottling is " + QString::number(USBSpaceWire_IsReadThrottling(hDevice))); |
|
454 | SocExplorerEngine::message(this->plugin,"USBSpaceWire_IsReadThrottling is " + QString::number(USBSpaceWire_IsReadThrottling(hDevice)),1); | |
394 | this->connected = true; |
|
455 | this->connected = true; | |
395 | this->handleMutex->unlock(); |
|
|||
396 | return true; |
|
456 | return true; | |
397 | } |
|
457 | } | |
398 |
|
458 | |||
399 | bool stardundeeSPW_USB_Manager::disconnectBridge() |
|
459 | bool stardundeeSPW_USB_Manager::disconnectBridge() | |
400 | { |
|
460 | { | |
401 | this->handleMutex->lock(); |
|
461 | this->handleMutex->lock(); | |
402 | USBSpaceWire_Close(hDevice); // Close the device |
|
462 | USBSpaceWire_Close(hDevice); // Close the device | |
403 | SocExplorerEngine::message(this->plugin,"stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(0)); |
|
463 | SocExplorerEngine::message(this->plugin,"stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(0),0); | |
404 | USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports |
|
464 | USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports | |
405 | this->handleMutex->unlock(); |
|
465 | this->handleMutex->unlock(); | |
|
466 | this->RMAP_pending_transaction_IDsMtx->lock(); | |||
|
467 | this->RMAP_pending_transaction_IDs.clear(); | |||
|
468 | this->RMAP_pending_transaction_IDsMtx->unlock(); | |||
|
469 | this->RMAP_AnswersMtx->lock(); | |||
|
470 | this->RMAP_Answers.clear(); | |||
|
471 | this->RMAP_AnswersMtx->unlock(); | |||
|
472 | this->RMAP_AnswersSem->acquire(this->RMAP_AnswersSem->available()); | |||
406 | return true; |
|
473 | return true; | |
407 | } |
|
474 | } | |
408 |
|
475 | |||
409 | int stardundeeSPW_USB_Manager::getRMAPtransactionID() |
|
476 | int stardundeeSPW_USB_Manager::getRMAPtransactionID() | |
410 | { |
|
477 | { | |
411 | this->RMAP_pending_transaction_IDsMtx->lock(); |
|
478 | this->RMAP_pending_transaction_IDsMtx->lock(); | |
412 | int ID=0; |
|
479 | int ID=0; | |
413 | bool found=true; |
|
480 | bool found=true; | |
414 |
while(ID< |
|
481 | while(ID<511) | |
415 | { |
|
482 | { | |
416 | for(int i=0;i<RMAP_pending_transaction_IDs.count();i++) |
|
483 | for(int i=0;i<RMAP_pending_transaction_IDs.count();i++) | |
417 | { |
|
484 | { | |
418 | if(RMAP_pending_transaction_IDs[i]==ID)found=false; |
|
485 | if(RMAP_pending_transaction_IDs[i]==ID)found=false; | |
419 | } |
|
486 | } | |
420 | if(found==true)break; |
|
487 | if(found==true)break; | |
421 | ID++; |
|
488 | ID++; | |
422 | found = true; |
|
489 | found = true; | |
423 | } |
|
490 | } | |
424 | if(found) |
|
491 | if(found) | |
425 | { |
|
492 | { | |
426 | RMAP_pending_transaction_IDs.append(ID); |
|
493 | RMAP_pending_transaction_IDs.append(ID); | |
427 | } |
|
494 | } | |
428 | this->RMAP_pending_transaction_IDsMtx->unlock(); |
|
495 | this->RMAP_pending_transaction_IDsMtx->unlock(); | |
429 | return ID; |
|
496 | return ID; | |
430 | } |
|
497 | } | |
431 |
|
498 | |||
432 | int stardundeeSPW_USB_Manager::getRMAPanswer(int transactionID, char **buffer) |
|
499 | int stardundeeSPW_USB_Manager::getRMAPanswer(int transactionID, char **buffer) | |
433 | { |
|
500 | { | |
|
501 | QTime timeout; | |||
434 | *buffer=NULL; |
|
502 | *buffer=NULL; | |
435 | int count=0; |
|
503 | int count=0; | |
|
504 | SocExplorerEngine::message(this->plugin,"Looking for RMAP answer",2); | |||
|
505 | timeout.start(); | |||
436 | while (*buffer==NULL) |
|
506 | while (*buffer==NULL) | |
437 | { |
|
507 | { | |
438 | this->RMAP_AnswersMtx->lock(); |
|
508 | this->RMAP_AnswersMtx->lock(); | |
|
509 | SocExplorerEngine::message(this->plugin,"Got exclusive access on RMAP_Answers stack",2); | |||
|
510 | SocExplorerEngine::message(this->plugin,QString("%2 packet(s) available in RMAP_Answers stack").arg(RMAP_Answers.count()),2); | |||
439 | for(int i=0;i<RMAP_Answers.count();i++) |
|
511 | for(int i=0;i<RMAP_Answers.count();i++) | |
440 | { |
|
512 | { | |
441 | if(RMAP_Answers[i]->transactionID==transactionID) |
|
513 | if(RMAP_Answers[i]->transactionID==transactionID) | |
442 | { |
|
514 | { | |
443 | this->RMAP_pending_transaction_IDsMtx->lock(); |
|
515 | this->RMAP_pending_transaction_IDsMtx->lock(); | |
|
516 | SocExplorerEngine::message(this->plugin,"Got exclusive access on RMAP_pending_transaction_ID stack",2); | |||
444 | for(int j=0;j<RMAP_pending_transaction_IDs.count();j++) |
|
517 | for(int j=0;j<RMAP_pending_transaction_IDs.count();j++) | |
445 | { |
|
518 | { | |
446 | if(RMAP_pending_transaction_IDs[j]==transactionID) |
|
519 | if(RMAP_pending_transaction_IDs[j]==transactionID) | |
447 | { |
|
520 | { | |
448 | RMAP_pending_transaction_IDs.removeAt(j); |
|
521 | RMAP_pending_transaction_IDs.removeAt(j); | |
449 | } |
|
522 | } | |
450 | } |
|
523 | } | |
451 | this->RMAP_pending_transaction_IDsMtx->unlock(); |
|
524 | this->RMAP_pending_transaction_IDsMtx->unlock(); | |
452 | *buffer = RMAP_Answers[i]->data; |
|
525 | *buffer = RMAP_Answers[i]->data; | |
453 | count = RMAP_Answers[i]->len; |
|
526 | count = RMAP_Answers[i]->len; | |
454 | RMAP_Answer* tmp=RMAP_Answers[i]; |
|
527 | RMAP_Answer* tmp=RMAP_Answers[i]; | |
455 | RMAP_Answers.removeAt(i); |
|
528 | RMAP_Answers.removeAt(i); | |
456 | delete tmp; |
|
529 | delete tmp; | |
457 | } |
|
530 | } | |
458 | } |
|
531 | } | |
459 | this->RMAP_AnswersMtx->unlock(); |
|
532 | this->RMAP_AnswersMtx->unlock(); | |
460 | //if no answer found in the stack wait until a new packet is pushed |
|
533 | //if no answer found in the stack wait until a new packet is pushed | |
461 | if(!buffer) |
|
534 | SocExplorerEngine::message(this->plugin,"waiting until a new packet is pushed",2); | |
|
535 | if(*buffer==NULL) | |||
|
536 | { | |||
|
537 | while (0==this->RMAP_AnswersSem->available()) | |||
462 | { |
|
538 | { | |
463 | SocExplorerEngine::message(this->plugin,"waiting until a new packet is pushed"); |
|
539 | SocExplorerEngine::message(this->plugin,QString("this->RMAP_AnswersSem->available() = %1").arg(this->RMAP_AnswersSem->available()),2); | |
|
540 | if(timeout.elapsed()>=RMAPtimeout) | |||
|
541 | { | |||
|
542 | SocExplorerEngine::message(this->plugin,"Timeout reached giving up!",2); | |||
|
543 | return -1; | |||
|
544 | } | |||
|
545 | usleep(1000); | |||
|
546 | } | |||
464 | this->RMAP_AnswersSem->acquire(); |
|
547 | this->RMAP_AnswersSem->acquire(); | |
465 | } |
|
548 | } | |
466 | } |
|
549 | } | |
467 | return count; |
|
550 | return count; | |
468 | } |
|
551 | } | |
469 |
|
552 | |||
470 | bool stardundeeSPW_USB_Manager::sendPacket(char *packet, int size) |
|
553 | bool stardundeeSPW_USB_Manager::sendPacket(char *packet, int size) | |
471 | { |
|
554 | { | |
472 | USB_SPACEWIRE_STATUS result; |
|
555 | USB_SPACEWIRE_STATUS result; | |
473 | USB_SPACEWIRE_ID pIdentifier; |
|
556 | USB_SPACEWIRE_ID pIdentifier; | |
474 | SocExplorerEngine::message(this->plugin,"Sending SPW packet"); |
|
557 | SocExplorerEngine::message(this->plugin,"Sending SPW packet",2); | |
475 | this->handleMutex->lock(); |
|
558 | this->handleMutex->lock(); | |
476 | result = USBSpaceWire_SendPacket(hDevice,packet,size,1, &pIdentifier); |
|
559 | result = USBSpaceWire_SendPacket(hDevice,packet,size,1, &pIdentifier); | |
477 | if (result != TRANSFER_SUCCESS) |
|
560 | if (result != TRANSFER_SUCCESS) | |
478 | { |
|
561 | { | |
479 | SocExplorerEngine::message(this->plugin,"ERR sending the READ command "); |
|
562 | SocExplorerEngine::message(this->plugin,"ERR sending the READ command ",2); | |
480 | this->handleMutex->unlock(); |
|
563 | this->handleMutex->unlock(); | |
481 | return false; |
|
564 | return false; | |
482 | } |
|
565 | } | |
483 | else |
|
566 | else | |
484 | { |
|
567 | { | |
485 | SocExplorerEngine::message(this->plugin,"Packet sent"); |
|
568 | SocExplorerEngine::message(this->plugin,"Packet sent",2); | |
486 | USBSpaceWire_FreeSend(hDevice, pIdentifier); |
|
569 | USBSpaceWire_FreeSend(hDevice, pIdentifier); | |
487 | } |
|
570 | } | |
488 | this->handleMutex->unlock(); |
|
571 | this->handleMutex->unlock(); | |
489 | return true; |
|
572 | return true; | |
490 | } |
|
573 | } | |
491 |
|
574 | |||
492 | void stardundeeSPW_USB_Manager::pushRmapPacket(char *packet, int len) |
|
575 | void stardundeeSPW_USB_Manager::pushRmapPacket(char *packet, int len) | |
493 | { |
|
576 | { | |
494 | char* packetbuffer = (char*)malloc(len); |
|
577 | char* packetbuffer = (char*)malloc(len); | |
495 | memcpy(packetbuffer,packet,len); |
|
578 | memcpy(packetbuffer,packet,len); | |
496 | RMAP_Answer* RMPAPpacket=new RMAP_Answer(RMAP_get_transactionID(packetbuffer+1),packetbuffer,len); |
|
579 | RMAP_Answer* RMPAPpacket=new RMAP_Answer(RMAP_get_transactionID(packetbuffer+1),packetbuffer,len); | |
497 | RMAP_AnswersMtx->lock(); |
|
580 | RMAP_AnswersMtx->lock(); | |
498 | RMAP_Answers.append(RMPAPpacket); |
|
581 | RMAP_Answers.append(RMPAPpacket); | |
499 | RMAP_AnswersMtx->unlock(); |
|
582 | RMAP_AnswersMtx->unlock(); | |
500 | } |
|
583 | } | |
501 |
|
584 | |||
502 |
|
585 | |||
503 |
|
586 | |||
504 |
|
587 | |||
505 |
|
588 | |||
506 |
|
589 | |||
507 |
|
590 | |||
508 |
|
591 | |||
509 |
|
592 | |||
510 |
|
593 | |||
511 |
|
594 | |||
512 |
|
595 | |||
513 |
|
596 | |||
514 |
|
597 | |||
515 |
|
598 | |||
516 |
|
599 | |||
517 |
|
600 | |||
518 |
|
601 | |||
519 |
|
602 | |||
520 |
|
603 | |||
521 |
|
604 | |||
522 |
|
605 |
@@ -1,104 +1,118 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 |
-- Copyright (C) 2014, |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
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 |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef STARDUNDEESPW_USB_H |
|
22 | #ifndef STARDUNDEESPW_USB_H | |
23 | #define STARDUNDEESPW_USB_H |
|
23 | #define STARDUNDEESPW_USB_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <spw_usb_api.h> |
|
26 | #include <spw_usb_api.h> | |
27 | #include <spw_config_library.h> |
|
27 | #include <spw_config_library.h> | |
28 | #include <socexplorerplugin.h> |
|
28 | #include <socexplorerplugin.h> | |
29 | #include <abstractspwbridge.h> |
|
29 | #include <abstractspwbridge.h> | |
30 | #include <QThread> |
|
30 | #include <QThread> | |
31 | #include <QMutex> |
|
31 | #include <QMutex> | |
32 | #include <QSemaphore> |
|
32 | #include <QSemaphore> | |
33 | #include <QGridLayout> |
|
33 | #include <QGridLayout> | |
34 | #include <QPushButton> |
|
34 | #include <QPushButton> | |
35 | #include <QComboBox> |
|
35 | #include <QComboBox> | |
36 | #include <QLabel> |
|
36 | #include <QLabel> | |
37 | #include "stardundeegui.h" |
|
37 | #include "stardundeegui.h" | |
38 |
|
38 | |||
39 | class RMAP_Answer |
|
39 | class RMAP_Answer | |
40 | { |
|
40 | { | |
41 | public: |
|
41 | public: | |
42 | RMAP_Answer(int ID,char* data,int len) |
|
42 | RMAP_Answer(int ID,char* data,int len) | |
43 | { |
|
43 | { | |
44 | transactionID = ID; |
|
44 | transactionID = ID; | |
45 | this->data = data; |
|
45 | this->data = data; | |
46 | this->len = len; |
|
46 | this->len = len; | |
47 | } |
|
47 | } | |
48 | int transactionID; |
|
48 | int transactionID; | |
49 | char* data; |
|
49 | char* data; | |
50 | int len; |
|
50 | int len; | |
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 | class stardundeeSPW_USB_Manager: public QThread |
|
53 | class stardundeeSPW_USB_Manager: public QThread | |
54 | { |
|
54 | { | |
55 | Q_OBJECT |
|
55 | Q_OBJECT | |
56 | public: |
|
56 | public: | |
57 | explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0); |
|
57 | explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0); | |
58 | ~stardundeeSPW_USB_Manager(); |
|
58 | ~stardundeeSPW_USB_Manager(); | |
59 | void run(); |
|
59 | void run(); | |
60 | bool connectBridge(); |
|
60 | bool connectBridge(); | |
61 | bool disconnectBridge(); |
|
61 | bool disconnectBridge(); | |
62 | int getRMAPtransactionID(); |
|
62 | int getRMAPtransactionID(); | |
63 | int getRMAPanswer(int transactionID,char** buffer); |
|
63 | int getRMAPanswer(int transactionID,char** buffer); | |
64 | bool sendPacket(char* packet,int size); |
|
64 | bool sendPacket(char* packet,int size); | |
|
65 | ||||
|
66 | signals: | |||
|
67 | void updateAvailableBrickCount(int count); | |||
65 | private: |
|
68 | private: | |
66 | QMutex* handleMutex,*RMAP_AnswersMtx,*RMAP_pending_transaction_IDsMtx; |
|
69 | QMutex* handleMutex,*RMAP_AnswersMtx,*RMAP_pending_transaction_IDsMtx; | |
67 | QSemaphore* RMAP_AnswersSem; |
|
70 | QSemaphore* RMAP_AnswersSem; | |
68 | void pushRmapPacket(char* packet,int len); |
|
71 | void pushRmapPacket(char* packet,int len); | |
69 | star_device_handle hDevice; |
|
72 | star_device_handle hDevice; | |
70 | socexplorerplugin* plugin; |
|
73 | socexplorerplugin* plugin; | |
71 | bool connected; |
|
74 | bool connected; | |
72 | char* SPWPacketBuff; |
|
75 | char* SPWPacketBuff; | |
73 | QList<RMAP_Answer*> RMAP_Answers; |
|
76 | QList<RMAP_Answer*> RMAP_Answers; | |
74 | QList<int> RMAP_pending_transaction_IDs; |
|
77 | QList<int> RMAP_pending_transaction_IDs; | |
|
78 | ||||
|
79 | public: | |||
|
80 | int selectedBrick; | |||
75 | int linkNumber; |
|
81 | int linkNumber; | |
76 | int brickList; |
|
82 | int brickList; | |
|
83 | int linkSpeed; | |||
|
84 | int destinationKey; | |||
|
85 | int rmapAddress; | |||
|
86 | int rmapKey; | |||
|
87 | int RMAPtimeout; | |||
77 | }; |
|
88 | }; | |
78 |
|
89 | |||
79 | class stardundeeSPW_USB : public abstractSpwBridge |
|
90 | class stardundeeSPW_USB : public abstractSpwBridge | |
80 | { |
|
91 | { | |
81 | Q_OBJECT |
|
92 | Q_OBJECT | |
82 | public: |
|
93 | public: | |
83 | explicit stardundeeSPW_USB(socexplorerplugin *parent = 0); |
|
94 | explicit stardundeeSPW_USB(socexplorerplugin *parent = 0); | |
84 | ~stardundeeSPW_USB(); |
|
95 | ~stardundeeSPW_USB(); | |
85 |
|
96 | |||
86 | signals: |
|
97 | signals: | |
87 |
|
98 | |||
88 | public slots: |
|
99 | public slots: | |
89 | void toggleBridgeConnection(); |
|
100 | void toggleBridgeConnection(); | |
90 | bool connectBridge(); |
|
101 | bool connectBridge(); | |
91 | bool disconnectBridge(); |
|
102 | bool disconnectBridge(); | |
92 | int pushRMAPPacket(char* packet,int size); |
|
103 | int pushRMAPPacket(char* packet,int size); | |
93 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
104 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); | |
94 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
105 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); | |
95 | void updateAvailableBrickCount(int count); |
|
106 | void brickSelectionChanged(int brickIndex); | |
|
107 | void linkNumberSelectionChanged(int linkIndex); | |||
|
108 | void linkSpeedSelectionChanged(const QString & linkSpeed); | |||
|
109 | void destinationKeyChanged(const QString & destKey); | |||
|
110 | void rmapAddressChanged(const QString & rmapaddress); | |||
|
111 | void rmapKeyChanged(const QString & key); | |||
96 | private: |
|
112 | private: | |
97 | void makeGUI(socexplorerplugin *parent); |
|
113 | void makeGUI(socexplorerplugin *parent); | |
98 | stardundeeSPW_USB_Manager* manager; |
|
114 | stardundeeSPW_USB_Manager* manager; | |
99 | QGridLayout* mainLayout; |
|
115 | // QGridLayout* mainLayout; | |
100 | QPushButton* connectBridgeButton; |
|
|||
101 | QComboBox* selectBrickQcmbx; |
|
|||
102 | }; |
|
116 | }; | |
103 |
|
117 | |||
104 | #endif // STARDUNDEESPW_USB_H |
|
118 | #endif // STARDUNDEESPW_USB_H |
General Comments 0
You need to be logged in to leave comments.
Login now