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