##// END OF EJS Templates
Improved APB UART Plugin, now check how many bytes are available on uart...
jeandet -
r32:4c8d1b562d91 default
parent child
Show More
@@ -1,64 +1,100
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "apbuart_plugin_ui.h"
23 23 #include "ui_apbuart_plugin_ui.h"
24 24 #include "apbuartterminal.h"
25 25
26 26 APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) :
27 27 QWidget(parent),
28 28 ui(new Ui::APBUART_Plugin_ui)
29 29 {
30 30 ui->setupUi(this);
31 31 connect(this->ui->FIFODebugChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int)));
32 32 connect(this,SIGNAL(apbUartTextReceived(QString)),this->ui->UART_TERM,SLOT(apbUartTextReceived(QString)));
33 33 connect(this->ui->ConnectQpb,SIGNAL(clicked()),this,SIGNAL(connectPort()));
34 34 connect(this->ui->UART_TERM,SIGNAL(sendChar(char)),this,SIGNAL(sendChar(char)));
35 35 connect(this->ui->PortNameLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(PortNameChanged(QString)));
36 36 connect(this->ui->UartSpeedLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(UartSpeedChanged(QString)));
37 connect(this->ui->rescanQpb,SIGNAL(clicked()),this,SLOT(updatePortList()));
38 this->portListcompleter = NULL;
39 this->updatePortList();
37 40 }
38 41
39 42 APBUART_Plugin_ui::~APBUART_Plugin_ui()
40 43 {
41 44 delete ui;
42 45 }
43 46
44 47 void APBUART_Plugin_ui::setEnableForLoopBack(bool enable)
45 48 {
46 49 this->ui->PortNameLineEdit->setEnabled(enable);
47 50 this->ui->ConnectQpb->setEnabled(enable);
48 51 this->ui->UartSpeedLineEdit->setEnabled(enable);
49 52 }
50 53
51 54 void APBUART_Plugin_ui::setUartConnected(bool enable)
52 55 {
53 56 this->ui->PortNameLineEdit->setDisabled(enable);
54 57 this->ui->UartSpeedLineEdit->setDisabled(enable);
55 58 this->ui->FIFODebugChkBx->setDisabled(enable);
56 59 if(enable)
57 60 {
58 61 this->ui->ConnectQpb->setText("Close Port");
59 62 }
60 63 else
61 64 {
62 65 this->ui->ConnectQpb->setText("Open Port");
63 66 }
64 67 }
68
69 #include <RS232.h>
70
71 void APBUART_Plugin_ui::updatePortList()
72 {
73 if(this->portListcompleter==(QCompleter*)NULL)
74 {
75 this->portListcompleter=new QCompleter(this);
76 this->portListcompleter->setCaseSensitivity(Qt::CaseInsensitive);
77 this->portListcompleterModel = new QStringListModel(this);
78 this->portListcompleter->setModel(this->portListcompleterModel);
79 this->ui->PortNameLineEdit->setCompleter(this->portListcompleter);
80 }
81 rs232portslist_t* portlist = rs232getportlist();
82 rs232portslist_t* portlistenum = portlist;
83 QStringList wordList;
84 while(portlistenum!=NULL)
85 {
86 wordList << portlistenum->name;
87 portlistenum = portlistenum->next;
88 }
89 rs232deleteportlist(portlist);
90 this->portListcompleterModel->setStringList(wordList);
91 }
92
93
94
95
96
97
98
99
100
@@ -1,53 +1,58
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef APBUART_PLUGIN_UI_H
23 23 #define APBUART_PLUGIN_UI_H
24 24
25 25 #include <QWidget>
26 #include <QCompleter>
27 #include <QStringListModel>
26 28
27 29 namespace Ui {
28 30 class APBUART_Plugin_ui;
29 31 }
30 32
31 33 class APBUART_Plugin_ui : public QWidget
32 34 {
33 35 Q_OBJECT
34 36
35 37 public:
36 38 explicit APBUART_Plugin_ui(QWidget *parent = 0);
37 39 ~APBUART_Plugin_ui();
38 40
39 41 public slots:
40 42 void setEnableForLoopBack(bool enable);
41 43 void setUartConnected(bool enable);
44 void updatePortList();
42 45 signals:
43 46 void loopbackChkBxStateChanged( int state );
44 47 void apbUartTextReceived(QString text);
45 48 void connectPort();
46 49 void sendChar(char c);
47 50 void UartSpeedChanged(QString text);
48 51 void PortNameChanged(QString text);
49 52 private:
50 53 Ui::APBUART_Plugin_ui *ui;
54 QCompleter *portListcompleter;
55 QStringListModel *portListcompleterModel;
51 56 };
52 57
53 58 #endif // APBUART_PLUGIN_UI_H
@@ -1,89 +1,96
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ui version="4.0">
3 3 <class>APBUART_Plugin_ui</class>
4 4 <widget class="QWidget" name="APBUART_Plugin_ui">
5 5 <property name="geometry">
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>400</width>
10 10 <height>300</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
14 14 <string>Form</string>
15 15 </property>
16 16 <layout class="QVBoxLayout" name="verticalLayout">
17 17 <item>
18 18 <widget class="QTabWidget" name="TabWidget">
19 19 <property name="currentIndex">
20 20 <number>0</number>
21 21 </property>
22 22 <widget class="QWidget" name="Config">
23 23 <attribute name="title">
24 24 <string>Configuration</string>
25 25 </attribute>
26 26 <layout class="QGridLayout" name="gridLayout">
27 27 <item row="1" column="1">
28 28 <widget class="QLineEdit" name="PortNameLineEdit"/>
29 29 </item>
30 30 <item row="0" column="0" colspan="2">
31 31 <widget class="QCheckBox" name="FIFODebugChkBx">
32 32 <property name="text">
33 33 <string>Enable FIFO debug mode</string>
34 34 </property>
35 35 <property name="checked">
36 36 <bool>false</bool>
37 37 </property>
38 38 </widget>
39 39 </item>
40 40 <item row="1" column="0">
41 41 <widget class="QLabel" name="PortNameLbl">
42 42 <property name="text">
43 43 <string>Port Name</string>
44 44 </property>
45 45 </widget>
46 46 </item>
47 47 <item row="3" column="0">
48 48 <widget class="QLabel" name="UartSpeedLbl">
49 49 <property name="text">
50 50 <string>Uart Speed</string>
51 51 </property>
52 52 </widget>
53 53 </item>
54 <item row="4" column="1">
54 <item row="1" column="2">
55 <widget class="QPushButton" name="rescanQpb">
56 <property name="text">
57 <string>Rescan ports</string>
58 </property>
59 </widget>
60 </item>
61 <item row="3" column="1" colspan="2">
62 <widget class="QLineEdit" name="UartSpeedLineEdit"/>
63 </item>
64 <item row="4" column="1" colspan="2">
55 65 <widget class="QPushButton" name="ConnectQpb">
56 66 <property name="text">
57 67 <string>Open Port</string>
58 68 </property>
59 69 </widget>
60 70 </item>
61 <item row="3" column="1">
62 <widget class="QLineEdit" name="UartSpeedLineEdit"/>
63 </item>
64 71 </layout>
65 72 </widget>
66 73 <widget class="QWidget" name="Terminal">
67 74 <attribute name="title">
68 75 <string>Terminal</string>
69 76 </attribute>
70 77 <layout class="QVBoxLayout" name="verticalLayout_2">
71 78 <item>
72 79 <widget class="ApbUartTerminal" name="UART_TERM"/>
73 80 </item>
74 81 </layout>
75 82 </widget>
76 83 </widget>
77 84 </item>
78 85 </layout>
79 86 </widget>
80 87 <customwidgets>
81 88 <customwidget>
82 89 <class>ApbUartTerminal</class>
83 90 <extends>QTextEdit</extends>
84 91 <header>apbuartterminal.h</header>
85 92 </customwidget>
86 93 </customwidgets>
87 94 <resources/>
88 95 <connections/>
89 96 </ui>
@@ -1,201 +1,217
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "uartpollingthread.h"
23 23 #include <socexplorerengine.h>
24 24
25 25 UARTPollingThread::UARTPollingThread(socexplorerplugin *parent) :
26 26 QThread((QObject*)parent)
27 27 {
28 28 this->plugin = parent;
29 29 uartMutex = new QMutex();
30 30 uartOpened = false;
31 31 fifoDebugConfigured = false;
32 32 fifoDebugEnabled = false;
33 33 this->moveToThread(this);
34 34 }
35 35
36 36 UARTPollingThread::~UARTPollingThread()
37 37 {
38 38 this->requestInterruption();
39 39 while(isRunning());
40 40 }
41 41
42 42 void UARTPollingThread::run()
43 43 {
44 44
45 char ch[4097];
46 int timeout =10;
45 47 SocExplorerEngine::message(this->plugin,"Entering APB UART polling thread",3);
46 48 while (!this->isInterruptionRequested())
47 49 {
48 50 if(fifoDebugEnabled)
49 51 {
50 52 if(fifoDebugConfigured)
51 53 {
52 54 if(this->plugin->baseAddress()!=-1)
53 55 {
54 56 unsigned int status_reg,data;
55 57 char ch;
56 58 QString printdata="";
57 59 plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG);
58 60 while ((status_reg&4)==0) {
59 61 plugin->parent->Read(&data,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG);
60 62 ch = (char)(0xff & data);
61 63 printdata+=ch;
62 64 plugin->parent->Read(&status_reg,1,this->plugin->baseAddress()+APB_UART_STATUS_REG);
63 65 }
64 66 if(printdata!="")
65 67 emit apbUartTextReceived(printdata);
66 68 }
67 69 else
68 70 {
69 71 this->plugin->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this->plugin,this->plugin->VID(),this->plugin->PID(),0));
70 72 }
71 73 }
72 74 else
73 75 {
74 76 configFifoDebug(true);
75 77 }
76 78 }
77 79 else
78 80 {
79 int read =0;
80 char ch[1];
81 int read =0,avail=0;
81 82 uartMutex->lock();
82 83 if(uartOpened)
83 84 {
84 read =rs232read(this->uart,ch,1);
85 avail = rs232availablebytes(this->uart);
86 SocExplorerEngine::message(this->plugin,QString("%1 available bytes on uart").arg(read),3);
87 if(avail)
88 {
89 if(avail>=4096)
90 {
91 read = rs232read(this->uart,ch,4096);
92 timeout = 0;
93 }
94 else
95 {
96 read = rs232read(this->uart,ch,avail);
97 timeout = 10;
98 }
85 99 SocExplorerEngine::message(this->plugin,QString("Read %1 bytes on uart").arg(read),3);
100 ch[read]='\0';
101 }
86 102 }
87 103 uartMutex->unlock();
88 104 if(read>=1)
89 105 {
90 SocExplorerEngine::message(this->plugin,QString("Received one char from APBUART"),3);
91 emit this->apbUartTextReceived(QString(ch[0]));
106 SocExplorerEngine::message(this->plugin,QString("Received %1 char(s) from APBUART").arg(read),3);
107 emit this->apbUartTextReceived(QString(ch));
92 108 }
93 msleep(10);
109 msleep(timeout);
94 110 }
95 111 }
96 112 }
97 113
98 114 void UARTPollingThread::sendChar(char c)
99 115 {
100 116 if(fifoDebugEnabled)
101 117 {
102 118 if(this->plugin->baseAddress()!=-1)
103 119 {
104 120 unsigned int i=0x0FF & c;
105 121 plugin->parent->Write(&i,1,this->plugin->baseAddress()+APB_UART_FIFO_DEBUG_REG);
106 122 }
107 123 }
108 124 else
109 125 {
110 126 uartMutex->lock();
111 127 rs232write(this->uart,&c,1);
112 128 uartMutex->unlock();
113 129 }
114 130 }
115 131
116 132 bool UARTPollingThread::openUart()
117 133 {
118 134 uartMutex->lock();
119 135 if(uartOpened)
120 136 {
121 137 closeUart();
122 138 }
123 139 SocExplorerEngine::message(this->plugin,"Opening UART "+this->portName,3);
124 140 this->uart = rs232open((char*)this->portName.toStdString().c_str());
125 141 if(this->uart!=badPortValue)
126 142 {
127 143 SocExplorerEngine::message(this->plugin,QString("Configuring UART, speed =%1").arg(this->uartSpeed),3);
128 144 rs232setup(this->uart,8,this->uartSpeed,rs232parityNo,rs232OneStop);
129 145 uartOpened = true;
130 146 }
131 147 uartMutex->unlock();
132 148 return uartOpened;
133 149 }
134 150
135 151 void UARTPollingThread::closeUart()
136 152 {
137 153 uartMutex->lock();
138 154 rs232close(this->uart);
139 155 uartOpened = false;
140 156 uartMutex->unlock();
141 157 }
142 158
143 159 void UARTPollingThread::setPortName(QString name)
144 160 {
145 161 SocExplorerEngine::message(this->plugin,"Changing UART port Name: "+name,3);
146 162 this->portName = name;
147 163 }
148 164
149 165 void UARTPollingThread::setPortSpeedStr(QString speed)
150 166 {
151 167 SocExplorerEngine::message(this->plugin,"Changing UART speed: "+speed,3);
152 168 this->uartSpeed = speed.toInt();
153 169 }
154 170
155 171 void UARTPollingThread::setPortSpeed(int speed)
156 172 {
157 173 SocExplorerEngine::message(this->plugin,QString("Changing UART speed: %1").arg(speed),3);
158 174 this->uartSpeed = speed;
159 175 }
160 176
161 177 void UARTPollingThread::setFifoDebugEable(bool enable)
162 178 {
163 179 if(enable)
164 180 SocExplorerEngine::message(this->plugin,"Enabling APB UART FIFO debug mode",3);
165 181 else
166 182 SocExplorerEngine::message(this->plugin,"Disabling APB UART FIFO debug mode",3);
167 183 if(uartOpened && enable)
168 184 {
169 185 closeUart();
170 186 }
171 187 this->fifoDebugConfigured = false;
172 188 configFifoDebug(enable);
173 189 this->fifoDebugEnabled = enable;
174 190 }
175 191
176 192 void UARTPollingThread::configFifoDebug(bool enable)
177 193 {
178 194 SocExplorerEngine::message(this->plugin,"Configuring APB UART in FIFO debug mode",3);
179 195 if(this->plugin->baseAddress()==-1)
180 196 {
181 197 this->plugin->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this->plugin,this->plugin->VID(),this->plugin->PID(),0));
182 198 }
183 199 if(this->plugin->baseAddress()!=-1)
184 200 {
185 201 if(enable)
186 202 {
187 203 unsigned int ctrl_reg= 0x843;
188 204 this->plugin->parent->Write(&ctrl_reg,1,this->plugin->baseAddress()+APB_UART_CONTROL_REG);
189 205 this->fifoDebugConfigured = true;
190 206 }
191 207 else
192 208 {
193 209 unsigned int ctrl_reg;
194 210 /* Firts get Control reg value*/
195 211 this->plugin->parent->Read(&ctrl_reg,1,this->plugin->baseAddress()+APB_UART_CONTROL_REG);
196 212 ctrl_reg = ctrl_reg & (~(1<<11));
197 213 this->plugin->parent->Write(&ctrl_reg,1,this->plugin->baseAddress()+APB_UART_CONTROL_REG);
198 214 this->fifoDebugConfigured = true;
199 215 }
200 216 }
201 217 }
@@ -1,57 +1,58
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "memchecker.h"
23 23
24 24 memchecker::memchecker(socexplorerplugin* plugin)
25 25 {
26 26 this->plugin = plugin;
27 27 }
28 28
29 bool memchecker::checkmemory(unsigned int address,unsigned int size)
29 QString memchecker::checkmemory(unsigned int address, unsigned int size, bool *success)
30 30 {
31 bool success = true;
31 *success = true;
32 QString repport;
32 33 unsigned int* dataLocal = (unsigned int*)malloc(size);
33 34 unsigned int* dataOnBoard = (unsigned int*)malloc(size);
34 35 for(int i=0;(unsigned int)i<(size>>2);i++)
35 36 {
36 37 dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
37 38 }
38 39 plugin->Write(dataLocal,size>>2,address);
39 40 plugin->Read(dataOnBoard,size>>2,address);
40 41 for(int i=0;(unsigned int)i<(size>>2);i++)
41 42 {
42 43 if(dataLocal[i]!=dataOnBoard[i])
43 success=false;
44 *success=false;
44 45 }
45
46 46 free(dataLocal);
47 47 free(dataOnBoard);
48 return success;
48 return repport;
49 49 }
50 50
51 bool memchecker::checkdatabits(unsigned int address,unsigned int size)
51 QString memchecker::checkdatabits(unsigned int address,unsigned int size,bool* success)
52 52 {
53 bool success = true;
54 return success;
53 *success = true;
54 QString repport;
55 return repport;
55 56 }
56 57
57 58
@@ -1,38 +1,38
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef MEMCHECKER_H
23 23 #define MEMCHECKER_H
24 24
25 25 #include <socexplorerplugin.h>
26 26
27 27 class memchecker
28 28 {
29 29 public:
30 30 memchecker(socexplorerplugin* plugin);
31 bool checkmemory(unsigned int address,unsigned int size);
32 bool checkdatabits(unsigned int address,unsigned int size);
31 QString checkmemory(unsigned int address,unsigned int size,bool* success);
32 QString checkdatabits(unsigned int address,unsigned int size,bool* success);
33 33
34 34 private:
35 35 socexplorerplugin* plugin;
36 36 };
37 37
38 38 #endif // MEMCHECKER_H
@@ -1,39 +1,52
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "memcheckplugin.h"
23 23
24 24 memcheckplugin::memcheckplugin(QWidget *parent):socexplorerplugin(parent,true)
25 25 {
26 26 this->UI = new memcheckplugin_ui();
27 27 this->setWidget(this->UI);
28 28 this->checker = new memchecker(this);
29 QObject::connect(this->UI,SIGNAL(checkdatabits(uint,uint)),this,SLOT(checkdatabits(uint,uint)));
30 QObject::connect(this->UI,SIGNAL(checkmemory(uint,uint)),this,SLOT(checkmemory(uint,uint)));
29 31 }
30 32
31 33 memcheckplugin::~memcheckplugin()
32 34 {}
33 35
34 void memcheckplugin::startCheck()
36
37 void memcheckplugin::checkmemory(unsigned int address, unsigned int size)
35 38 {
39 bool success;
40 QString repport=this->checker->checkmemory(address,size,&success);
41 this->UI->setResult(success,repport);
36 42
37 43 }
38 44
45 void memcheckplugin::checkdatabits(unsigned int address, unsigned int size)
46 {
47 bool success;
48 QString repport=this->checker->checkdatabits(address,size,&success);
49 this->UI->setResult(success,repport);
50 }
39 51
52
@@ -1,69 +1,70
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef MEMCTRLRPLUGIN_H
23 23 /*------------------------------------------------------------------------------
24 24 -- This file is a part of the SocExplorer Software
25 25 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
26 26 --
27 27 -- This program is free software; you can redistribute it and/or modify
28 28 -- it under the terms of the GNU General Public License as published by
29 29 -- the Free Software Foundation; either version 3 of the License, or
30 30 -- (at your option) any later version.
31 31 --
32 32 -- This program is distributed in the hope that it will be useful,
33 33 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
34 34 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 35 -- GNU General Public License for more details.
36 36 --
37 37 -- You should have received a copy of the GNU General Public License
38 38 -- along with this program; if not, write to the Free Software
39 39 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 40 -------------------------------------------------------------------------------*/
41 41 /*-- Author : Alexis Jeandet
42 42 -- Mail : alexis.jeandet@lpp.polytechnique.fr
43 43 ----------------------------------------------------------------------------*/
44 44 #define MEMCTRLRPLUGIN_H
45 45 #include "memcheckplugin_ui.h"
46 46 #include <QMenuBar>
47 47 #include <QMenu>
48 48 #include <QAction>
49 49 #include <QMainWindow>
50 50 #include <socexplorerplugin.h>
51 51 #include <memchecker.h>
52 52 #include <socexplorerplugin.h>
53 53
54 54 class memcheckplugin : public socexplorerplugin
55 55 {
56 56 Q_OBJECT
57 57 public:
58 58 explicit memcheckplugin(QWidget *parent = 0);
59 59 ~memcheckplugin();
60 60 public slots:
61 void startCheck();
61 void checkmemory(unsigned int address,unsigned int size);
62 void checkdatabits(unsigned int address,unsigned int size);
62 63 signals:
63 64
64 65 private:
65 66 memcheckplugin_ui* UI;
66 67 memchecker* checker;
67 68 };
68 69
69 70 #endif // MEMCTRLRPLUGIN_H
@@ -1,54 +1,67
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "memcheckplugin_ui.h"
23 23 #include "ui_memcheckplugin_ui.h"
24 24 #include <memsizewdgt.h>
25 25 #include <qhexspinbox.h>
26 26
27 27 memcheckplugin_ui::memcheckplugin_ui(QWidget *parent) :
28 28 QWidget(parent),
29 29 ui(new Ui::memcheckplugin_ui)
30 30 {
31 31 ui->setupUi(this);
32 32 connect(this->ui->StartTestQpb,SIGNAL(clicked()),this,SLOT(startCheck()));
33 33 }
34 34
35 35 memcheckplugin_ui::~memcheckplugin_ui()
36 36 {
37 37 delete ui;
38 38 }
39 39
40 40 void memcheckplugin_ui::startCheck()
41 41 {
42 42 if(this->ui->testTypeQchkBx->currentText()=="Check data bits")
43 43 {
44 44 emit checkdatabits(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
45 45 }
46 46 if(this->ui->testTypeQchkBx->currentText()=="Check memory size")
47 47 {
48 48 emit checkmemory(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
49 49 }
50 50 if(this->ui->testTypeQchkBx->currentText()=="Full test")
51 51 {
52 52
53 53 }
54 54 }
55
56 void memcheckplugin_ui::setResult(bool success, QString repport)
57 {
58 this->ui->testDetails->setText(repport);
59 if(success)
60 {
61 this->ui->TestResult->setText("Success");
62 }
63 else
64 {
65 this->ui->TestResult->setText("Failed");
66 }
67 }
@@ -1,47 +1,48
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef MEMCHECKPLUGIN_UI_H
23 23 #define MEMCHECKPLUGIN_UI_H
24 24
25 25 #include <QWidget>
26 26
27 27 namespace Ui {
28 28 class memcheckplugin_ui;
29 29 }
30 30
31 31 class memcheckplugin_ui : public QWidget
32 32 {
33 33 Q_OBJECT
34 34
35 35 public:
36 36 explicit memcheckplugin_ui(QWidget *parent = 0);
37 37 ~memcheckplugin_ui();
38 38 public slots:
39 39 void startCheck();
40 void setResult(bool success,QString repport);
40 41 signals:
41 bool checkmemory(unsigned int address,unsigned int size);
42 bool checkdatabits(unsigned int address,unsigned int size);
42 void checkmemory(unsigned int address,unsigned int size);
43 void checkdatabits(unsigned int address,unsigned int size);
43 44 private:
44 45 Ui::memcheckplugin_ui *ui;
45 46 };
46 47
47 48 #endif // MEMCHECKPLUGIN_UI_H
General Comments 0
You need to be logged in to leave comments. Login now