##// END OF EJS Templates
updated plugin headers and win32/Apbuart fix tentative.
Jeandet Alexis -
r4:73bdcb77e383 default
parent child
Show More
@@ -1,185 +1,188
1 /*------------------------------------------------------------------------------ -- This file is a part of the LPPMON Software
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - CNRS
3 4 --
4 5 -- This program is free software; you can redistribute it and/or modify
5 6 -- it under the terms of the GNU General Public License as published by
6 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 2 of the License, or
7 8 -- (at your option) any later version.
8 9 --
9 10 -- This program is distributed in the hope that it will be useful,
10 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 13 -- GNU General Public License for more details.
13 14 --
14 15 -- You should have received a copy of the GNU General Public License
15 16 -- along with this program; if not, write to the Free Software
16 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 18 -------------------------------------------------------------------------------*/
18 19 /*-- Author : Alexis Jeandet
19 20 -- Mail : alexis.jeandet@member.fsf.org
20 21 ----------------------------------------------------------------------------*/
21 22 #include "APBUARTPLUGIN.h"
22 23 #include <socexplorerengine.h>
23 24
24 25
25 26 ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent)
26 27 {
27 28 this->UI = new ApbUartPluginUi();
28 29 this->setWindowTitle(tr("APBUART"));
29 30 this->setWidget((QWidget*)this->UI);
30 31 this->useLoopBack = false;
31 32 connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int)));
32 33 connect(this,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString)));
33 34 connect(&this->loopBackTimer,SIGNAL(timeout()),this,SLOT(uartReadout()));
34 35 }
35 36
36 37
37 38 ApbUartPlugin::~ApbUartPlugin()
38 39 {
39 40
40 41 }
41 42
42 43 void ApbUartPlugin::closeMe()
43 44 {
44 45 emit this->closePlugin(this);
45 46 }
46 47
47 48 void ApbUartPlugin::postInstantiationTrigger()
48 49 {
49 50 if(this->isEnabled())
50 51 {
51 52 this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0));
52 53 loopbackChangeState(Qt::Checked);
53 54 }
54 55 }
55 56
56 57 void ApbUartPlugin::loopbackChangeState(int state)
57 58 {
58 59 if(state==Qt::Checked)
59 60 {
60 61 enableLoopback();
61 62 }
62 63 else
63 64 {
64 65 disableLoopback();
65 66 }
66 67 }
67 68
68 69 void ApbUartPlugin::uartReadout()
69 70 {
70 71 if(this->isEnabled() && parent!=NULL)
71 72 {
72 73 if(this->useLoopBack)
73 74 {
74 75 if(this->baseAddress()!=-1)
75 76 {
77 this->loopBackTimer.stop();
76 78 unsigned int status_reg,data;
77 79 char ch;
78 80 QString printdata="";
79 81 parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG);
80 82 while ((status_reg&4)==0) {
81 83 parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG);
82 84 ch = (char)(0xff & data);
83 85 printdata+=ch;
84 86 parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG);
85 87 }
86 88 if(printdata!="")
87 89 emit apbUartTextReceived(printdata);
90 this->loopBackTimer.start();
88 91 }
89 92 else
90 93 {
91 94 this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0));
92 95 this->enableLoopback();
93 96 }
94 97 }
95 98 }
96 99 }
97 100
98 101 void ApbUartPlugin::activate(bool flag)
99 102 {
100 103 this->setEnabled(flag);
101 104 emit this->activateSig(flag);
102 105 if(this->isEnabled())
103 106 {this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0));
104 107
105 108 loopbackChangeState(Qt::Checked);
106 109 }
107 110 }
108 111
109 112 void ApbUartPlugin::activateScan(bool flag)
110 113 {
111 114 if(flag)
112 this->loopBackTimer.start(100);
115 this->loopBackTimer.start(200);
113 116 else
114 117 this->loopBackTimer.stop();
115 118 }
116 119
117 120 int ApbUartPlugin::enableLoopback()
118 121 {
119 122
120 123 this->useLoopBack = true;
121 this->loopBackTimer.start(100);
124 this->loopBackTimer.start(200);
122 125 SocExplorerEngine::message(this,"Set FiFo debug mode mode");
123 126 if(parent==NULL)
124 127 {
125 128 SocExplorerEngine::message(this,"Can't set FiFo debug mode no parent driver accessible");
126 129 return -1;
127 130 }
128 131 if(this->baseAddress()==-1)
129 132 {
130 133 this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0));
131 134 if(this->baseAddress()==-1)
132 135 return -1;
133 136 }
134 137 unsigned int ctrl_reg= 0x843;
135 138 parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
136 139 return 0;
137 140 }
138 141
139 142 int ApbUartPlugin::disableLoopback()
140 143 {
141 144 SocExplorerEngine::message(this,"Disable FiFo debug mode mode");
142 145 if(parent==NULL)
143 146 {
144 147 SocExplorerEngine::message(this,"Can't disable FiFo debug mode no parent driver accessible");
145 148 return -1;
146 149 }
147 150 if(this->baseAddress()==-1)
148 151 {
149 152 this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),0));
150 153 if(this->baseAddress()==-1)
151 154 return -1;
152 155 }
153 156 unsigned int ctrl_reg;
154 157 this->loopBackTimer.stop();
155 158 /* Firts get Control reg value*/
156 159 parent->Read(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
157 160 ctrl_reg = ctrl_reg & (~(1<<11));
158 161 parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
159 162 this->useLoopBack = false;
160 163 return 0;
161 164 }
162 165
163 166
164 167 unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
165 168 {
166 169 if(parent!=NULL)
167 170 return parent->Read(Value,count,address);
168 171 return 0;
169 172 }
170 173
171 174
172 175 unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
173 176 {
174 177 if(parent!=NULL)
175 178 return parent->Write(Value,count,address);
176 179 return 0;
177 180 }
178 181
179 182
180 183
181 184
182 185
183 186
184 187
185 188
@@ -1,69 +1,69
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef APBUARTPLUGIN_H
23 23 #define APBUARTPLUGIN_H
24 24 #include <QMenuBar>
25 25 #include <QMenu>
26 26 #include <QAction>
27 27 #include <QLayout>
28 28
29 29 #include <socexplorerplugin.h>
30 30 #include <apbuartpluginui.h>
31 31 #include <QTimer>
32 32
33 33 #define APB_UART_DATA_REG 0x0
34 34 #define APB_UART_STATUS_REG 0x4
35 35 #define APB_UART_CONTROL_REG 0x8
36 36 #define APB_UART_SCALE_REG 0xC
37 37 #define APB_UART_FIFO_DEBUG_REG 0x10
38 38
39 39
40 40 class ApbUartPlugin : public socexplorerplugin
41 41 {
42 42 Q_OBJECT
43 43 public:
44 44 explicit ApbUartPlugin(QWidget *parent = 0);
45 45 ~ApbUartPlugin();
46 46 int VID(){return driver_VID;}
47 47 int PID(){return driver_PID;}
48 48
49 49 public slots:
50 50 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
51 51 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
52 52 void closeMe();
53 53 void postInstantiationTrigger();
54 54 void loopbackChangeState( int state );
55 55 void uartReadout();
56 56 void activateScan(bool flag);
57 57 void activate(bool flag);
58 58 signals:
59 59 void apbUartTextReceived(QString text);
60 60 private:
61 61 ApbUartPluginUi* UI;
62 62 bool useLoopBack;
63 63 QTimer loopBackTimer;
64 64 int enableLoopback();
65 65 int disableLoopback();
66 66 };
67 67
68 68 #endif // APBUARTPLUGIN_H
69 69
@@ -1,33 +1,33
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "apbuartcfg.h"
23 23
24 24 ApbUartCfg::ApbUartCfg(QWidget *parent) :
25 25 QWidget(parent)
26 26 {
27 27 this->mainLayout = new QGridLayout(this);
28 28 this->loopbackChkBx = new QCheckBox(tr("Enable loopback"),this);
29 29 this->loopbackChkBx->setChecked(true);
30 30 this->mainLayout->addWidget(this->loopbackChkBx);
31 31 this->setLayout(this->mainLayout);
32 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef APBUARTCFG_H
23 23 #define APBUARTCFG_H
24 24
25 25 #include <QWidget>
26 26 #include <QCheckBox>
27 27 #include <QLabel>
28 28 #include <QGridLayout>
29 29
30 30 class ApbUartCfg : public QWidget
31 31 {
32 32 Q_OBJECT
33 33 public:
34 34 explicit ApbUartCfg(QWidget *parent = 0);
35 35
36 36 signals:
37 37 void loopbackChkBxStateChanged( int state );
38 38 public slots:
39 39
40 40 private:
41 41 QCheckBox* loopbackChkBx;
42 42 QGridLayout* mainLayout;
43 43
44 44 };
45 45
46 46 #endif // APBUARTCFG_H
@@ -1,34 +1,34
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "apbuartpluginui.h"
23 23
24 24 ApbUartPluginUi::ApbUartPluginUi(QWidget *parent) :
25 25 QTabWidget(parent)
26 26 {
27 27 this->terminal = new ApbUartTerminal(this);
28 28 this->cfg = new ApbUartCfg(this);
29 29
30 30 this->addTab(this->cfg,"Config");
31 31 this->addTab(this->terminal,"terminal");
32 32 connect(this->cfg,SIGNAL(loopbackChkBxStateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int)));
33 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef APBUARTPLUGINUI_H
23 23 #define APBUARTPLUGINUI_H
24 24
25 25 #include "apbuartcfg.h"
26 26 #include <QWidget>
27 27 #include <QGridLayout>
28 28 #include <QTabWidget>
29 29 #include <QCheckBox>
30 30 #include <QLabel>
31 31 #include <QLineEdit>
32 32 #include <QTextEdit>
33 33 #include "apbuartterminal.h"
34 34
35 35 class ApbUartPluginUi : public QTabWidget
36 36 {
37 37 Q_OBJECT
38 38 public:
39 39 explicit ApbUartPluginUi(QWidget *parent = 0);
40 40
41 41 signals:
42 42 void loopbackChkBxStateChanged( int state );
43 43 void apbUartTextReceived(QString text);
44 44 public slots:
45 45
46 46 private:
47 47 ApbUartCfg* cfg;
48 48 ApbUartTerminal* terminal;
49 49 };
50 50
51 51 #endif // APBUARTPLUGINUI_H
@@ -1,28 +1,28
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "apbuartterminal.h"
23 23
24 24 ApbUartTerminal::ApbUartTerminal(QWidget *parent) :
25 25 QTextEdit(parent)
26 26 {
27 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef APBUARTTERMINAL_H
23 23 #define APBUARTTERMINAL_H
24 24
25 25 #include <QWidget>
26 26 #include <QTextEdit>
27 27
28 28
29 29 class ApbUartTerminal : public QTextEdit
30 30 {
31 31 Q_OBJECT
32 32 public:
33 33 explicit ApbUartTerminal(QWidget *parent = 0);
34 34
35 35 signals:
36 36 void apbUartTextReceived(QString text);
37 37 public slots:
38 38
39 39 };
40 40
41 41 #endif // APBUARTTERMINAL_H
@@ -1,459 +1,459
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 <socexplorerengine.h>
23 23 #include "ahbuartplugin.h"
24 24 #include <unistd.h>
25 25 #include <errno.h>
26 26 #include <QApplication>
27 27 #include <QProgressBar>
28 28 #include <stdio.h>
29 29 #include <QThread>
30 30 #include "ahbuartpywrapper.h"
31 31 #include <QCompleter>
32 32 #include <QStringList>
33 33 #include <QLineEdit>
34 34 #include <socexplorerproxy.h>
35 35
36 36 ahbuartplugin::ahbuartplugin(QWidget *parent):socexplorerplugin(parent,false)
37 37 {
38 38 this->port =(rs232port_t)NULL;
39 39 this->portMutex = new QMutex(QMutex::Recursive);
40 40 this->UI = new ahbUartPluginUI();
41 41 this->setWidget((QWidget*)this->UI);
42 42 this->setWindowTitle(tr("AHB UART"));
43 43 QObject::connect(this,SIGNAL(activateSig(bool)),this->UI,SLOT(setConnected(bool)));
44 44 QObject::connect(this->UI,SIGNAL(connectPortsig(QString,int)),this,SLOT(togglePort(QString,int)));
45 45 this->pyObject = new ahbuartPywrapper(this);
46 46 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(open(QString,int)),this,SLOT(open(QString,int)));
47 47 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(close()),this,SLOT(close()));
48 48 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(ReadBytes(uint,uint)),this,SLOT(ReadBytes(uint,uint)));
49 49 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(WriteBytes(uint,QList<QVariant>)),this,SLOT(WriteBytes(uint,QList<QVariant>)));
50 50 QObject::connect(this->UI,SIGNAL(rescanPorts()),this,SLOT(updatePortList()));
51 51 this->portListcompleter = NULL;
52 52 this->scanDone = false;
53 53 updatePortList();
54 54 }
55 55
56 56
57 57 ahbuartplugin::~ahbuartplugin()
58 58 {
59 59 if(this->port!=(rs232port_t)NULL)
60 60 {
61 61 rs232close(this->port);
62 62 this->port = (rs232port_t)NULL;
63 63 }
64 64 this->UI->close();
65 65 this->UI->~ahbUartPluginUI();
66 66 }
67 67
68 68
69 69 void ahbuartplugin::closeMe()
70 70 {
71 71 if(this->port!=(rs232port_t)NULL)
72 72 {
73 73 rs232close(this->port);
74 74 this->port = (rs232port_t)NULL;
75 75 }
76 76 emit this->closePlugin(this);
77 77 }
78 78
79 79 int ahbuartplugin::registermenu(QMainWindow *menuHolder)
80 80 {
81 81 this->menu = menuHolder->menuBar()->addMenu(tr("&AHB UART"));
82 82 this->closeAction = this->menu->addAction(tr("Close plugin"));
83 83 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
84 84 return 1;
85 85 }
86 86
87 87
88 88
89 89
90 90 bool ahbuartplugin::checkConnection()
91 91 {
92 92 QTime timeout;
93 93 char test[5] ={(char)0x80,(char)0x80,(char)0,(char)0,(char)0};
94 94 char test2[1024];
95 95 int writen =0;
96 96 int read = 0;
97 97 timeout.start();
98 98 SocExplorerEngine::message(this,"Check connection",2);
99 99 while(writen!=5)
100 100 {
101 101 writen+=rs232write(this->port,test+writen,5-writen);
102 102 if(timeout.elapsed()>1000)
103 103 {
104 104 SocExplorerEngine::message(this,"Can't write any data on serial port",2);
105 105 return false;
106 106 }
107 107 }
108 108 timeout.restart();
109 109 while(read!=4)
110 110 {
111 111 read += rs232read(this->port,test2,4-read);
112 112 if(timeout.elapsed()>1000) break;
113 113 }
114 114 if(read>0)
115 115 {
116 116 SocExplorerEngine::message(this,"Connection Ok",2);
117 117 return true;
118 118 }
119 119 else
120 120 {
121 121 SocExplorerEngine::message(this,"Connection Error",2);
122 122 return false;
123 123 }
124 124
125 125 }
126 126
127 127 void ahbuartplugin::connectPort(QString PortName, int baudrate)
128 128 {
129 129 QTime timeout;
130 130 SocExplorerEngine::message(this,"Try to connect to port "+PortName,2);
131 131 timeout.start();
132 132 if(this->port==(rs232port_t)NULL)
133 133 {
134 134 SocExplorerEngine::message(this,"Open port "+PortName,2);
135 135 this->port=rs232open((char*)PortName.toStdString().c_str());
136 136 }
137 137 if(this->port!=badPortValue)
138 138 {
139 139 SocExplorerEngine::message(this,"Port opened "+PortName,2);
140 140 SocExplorerEngine::message(this,"Configure port "+PortName,2);
141 141 rs232setup(this->port,8,baudrate,rs232parityNo,rs232OneStop);
142 142 char test[7] ={(char)0x55,(char)0x51,(char)0x80,(char)0x80,(char)0x0,(char)0x0,(char)0x14};
143 143 char test2[1024];
144 144 SAFEWRITE(test,1,timeout,2000,return);
145 145 SAFEWRITE((test+1),1,timeout,2000,return);
146 146 APPENDTOLOG(QString("Flush port "));
147 147 rs232read(this->port,test2,512);
148 148 int read = 0;
149 149 for(int i=0;i<10;i++)
150 150 {
151 151 SocExplorerEngine::message(this,"Send test patern :0x55,0x55,0x80,0x80,0x0,0x0,0x14",2);
152 152 SAFEWRITE(test+2,5,timeout,2000,return);
153 153 SocExplorerEngine::message(this,"Read Result",2);
154 154 read=rs232read(this->port,test2+read,16);
155 155 SocExplorerEngine::message(this,QString("Get ") + QString::number(read) + " bytes",2);
156 156 if(read>0)
157 157 {
158 158 SocExplorerEngine::message(this,"Flush port ",2);
159 159 while(rs232read(this->port,test2,1)>0);
160 160 this->Connected = true;
161 161 SocExplorerEngine::message(this,QString("Connection success on ")+PortName,2);
162 162 emit this->activate(true);
163 163 if(this->scanDone==false)
164 164 {
165 165 socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN");
166 166 this->scanDone=true;
167 167 }
168 168 break;
169 169 }
170 170 }
171 171 }
172 172 else
173 173 {
174 174 SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2);
175 175 this->port = (rs232port_t)NULL;
176 176 this->Connected = false;
177 177 emit this->activateSig(false);
178 178 return;
179 179 }
180 180 if(this->Connected == false)
181 181 {
182 182 SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2);
183 183 rs232close(this->port);
184 184 this->port = (rs232port_t)NULL;
185 185 emit this->activateSig(false);
186 186 }
187 187
188 188 }
189 189
190 190 bool ahbuartplugin::open(QString PortName,int baudrate)
191 191 {
192 192 if(this->port!=(rs232port_t)NULL)
193 193 this->close();
194 194 this->UI->setconfig(PortName,baudrate);
195 195 this->connectPort(PortName,baudrate);
196 196 return (this->port!=(rs232port_t)NULL);
197 197 }
198 198
199 199 void ahbuartplugin::close()
200 200 {
201 201 if(this->port!=(rs232port_t)NULL)
202 202 {
203 203 rs232close(this->port);
204 204 this->port = (rs232port_t)NULL;
205 205 this->Connected = false;
206 206 emit this->activateSig(false);
207 207 }
208 208 }
209 209
210 210 void ahbuartplugin::togglePort(QString PortName,int baudrate)
211 211 {
212 212 if(this->port!=(rs232port_t)NULL)
213 213 {
214 214 this->close();
215 215 }
216 216 else
217 217 {
218 218 this->connectPort(PortName,baudrate);
219 219 }
220 220 }
221 221
222 222
223 223 unsigned int ahbuartplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
224 224 {
225 225 QTime timeout;
226 226 timeout.start();
227 227 unsigned int read=0;
228 228 unsigned int cnt=count;
229 229 unsigned int nextUpdateTrig=0,updateStep=512;
230 230 SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
231 231 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
232 232 {
233 233 if(!this->portMutex->tryLock())
234 234 return 0;
235 235 if(!this->checkConnection())
236 236 {
237 237 this->Connected = false;
238 238 emit this->activateSig(false);
239 239 this->portMutex->unlock();
240 240 return 0;
241 241 }
242 242 QProgressBar* progress=NULL;
243 243 if(cnt>128)
244 244 progress= SocExplorerEngine::getProgressBar("Reading on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
245 245 char CMD[5];
246 246 char* result = (char*)malloc(count*4);
247 247 while(count>32)
248 248 {
249 249 CMD[0] = 0x80 | (32-1);
250 250 CMD[1] = (char)((address>>24)&0xFF);
251 251 CMD[2] = (char)((address>>16)&0xFF);
252 252 CMD[3] = (char)((address>>8)&0xFF);
253 253 CMD[4] = (char)((address)&0xFF);
254 254 // APENDTABLETOLOG(CMD,5,logmessage,"Write CMD : ");
255 255 SAFEWRITE(CMD,5,timeout,1000,return 0);
256 256 SAFEREAD(result+((cnt-count)*4),32*4,timeout,1000,return 0);
257 257 // APENDTABLETOLOG((result+((cnt-count)*4)),32*4,logmessage, QString("Get ") + QString::number(32*4) + " Bytes : ");
258 258 count-=32;
259 259 address+=32*4;
260 260 if(cnt>128)
261 261 {
262 262
263 263 if((cnt-count)>=nextUpdateTrig)
264 264 {
265 265 progress->setValue(cnt-count);
266 266 qApp->processEvents();
267 267 nextUpdateTrig+=updateStep;
268 268 }
269 269 }
270 270 }
271 271 if(count>0)
272 272 {
273 273 CMD[0] = 0x80 | (count-1);
274 274 CMD[1] = (char)((address>>24)&0xFF);
275 275 CMD[2] = (char)((address>>16)&0xFF);
276 276 CMD[3] = (char)((address>>8)&0xFF);
277 277 CMD[4] = (char)((address)&0xFF);
278 278 SAFEWRITE(CMD,5,timeout,1000,return 0);
279 279 SAFEREAD(result+((cnt-count)*4),(count*4),timeout,1000,return 0);
280 280 // APENDTABLETOLOG((result+((cnt-count)*4)),(count*4),logmessage, QString("Get ") + QString::number(32*4) + " Bytes : ");
281 281 }
282 282 if(cnt>128)
283 283 {
284 284 progress->setValue(cnt-count);
285 285 qApp->processEvents();
286 286 }
287 287 for(int i=0;(unsigned int)i<cnt;i++)
288 288 {
289 289 for(int j =0;j<4;j++)
290 290 {
291 291 Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256;
292 292 }
293 293 read = cnt*4;
294 294
295 295 }
296 296 if(cnt>128)
297 297 SocExplorerEngine::deleteProgressBar(progress);
298 298 free(result);
299 299 this->portMutex->unlock();
300 300 }
301 301 return read/4;
302 302 }
303 303
304 304 unsigned int ahbuartplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
305 305 {
306 306 QTime timeout;
307 307 timeout.start();
308 308 unsigned int writen=0;
309 309 unsigned int nextUpdateTrig=0,updateStep=512;
310 310 SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
311 311 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
312 312 {
313 313 if(!this->portMutex->tryLock())
314 314 return 0;
315 315 if(!this->checkConnection())
316 316 {
317 317 emit this->activateSig(false);
318 318 this->Connected = false;
319 319 this->portMutex->unlock();
320 320 return 0;
321 321 }
322 322 QProgressBar* progress = NULL;
323 323 if(count>128)
324 324 progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
325 325 int offset = 0;
326 326 char* CMD= (char*)malloc((32*4)+5);
327 327 while(count>32)
328 328 {
329 329 writen=0;
330 330 CMD[0] = 0xC0 | (32-1);
331 331 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
332 332 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
333 333 CMD[3] = (char)(((unsigned int)address>>8)&0xFF);
334 334 CMD[4] = (char)(((unsigned int)address)&0xFF);
335 335 for(int i=0;i<32;i++)
336 336 {
337 337 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
338 338 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
339 339 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
340 340 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF);
341 341 }
342 342 SAFEWRITE(CMD,((32*4)+5),timeout,1000,return 0);
343 343 writen+=32;
344 344 count-=32;
345 345 offset+=32;
346 346 address+=32*4;
347 347 if(offset>=nextUpdateTrig && progress!=NULL)
348 348 {
349 349 progress->setValue(offset);
350 350 qApp->processEvents();
351 351 nextUpdateTrig +=updateStep;
352 352 }
353 353
354 354 }
355 355 if(count>0)
356 356 {
357 357 CMD[0] = 0xC0 | (count-1);
358 358 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
359 359 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
360 360 CMD[3] = (char)(((unsigned int)address>>8)&0xFF);
361 361 CMD[4] = (char)(((unsigned int)address)&0xFF);
362 362 for(int i=0;(unsigned int) i<(count);i++)
363 363 {
364 364 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
365 365 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
366 366 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
367 367 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF);
368 368 }
369 369 SAFEWRITE(CMD,((count*4)+5),timeout,1000,return 0);
370 370 writen+=count;
371 371 }
372 372 if(progress!=NULL)
373 373 {
374 374 progress->setValue(writen);
375 375 qApp->processEvents();
376 376 SocExplorerEngine::deleteProgressBar(progress);
377 377 }
378 378 free(CMD);
379 379 this->portMutex->unlock();
380 380 return writen;
381 381 }
382 382 return 0;
383 383 }
384 384
385 385
386 386
387 387
388 388 void ahbuartplugin::updatePortList()
389 389 {
390 390 if(this->portListcompleter==(QCompleter*)NULL)
391 391 {
392 392 this->portListcompleter=new QCompleter(this);
393 393 this->portListcompleter->setCaseSensitivity(Qt::CaseInsensitive);
394 394 this->portListcompleterModel = new QStringListModel(this);
395 395 this->portListcompleter->setModel(this->portListcompleterModel);
396 396 this->UI->setCompleter(this->portListcompleter);
397 397 }
398 398 rs232portslist_t* portlist = rs232getportlist();
399 399 rs232portslist_t* portlistenum = portlist;
400 400 QStringList wordList;
401 401 while(portlistenum!=NULL)
402 402 {
403 403 wordList << portlistenum->name;
404 404 portlistenum = portlistenum->next;
405 405 }
406 406 rs232deleteportlist(portlist);
407 407 this->portListcompleterModel->setStringList(wordList);
408 408 }
409 409
410 410 QVariantList ahbuartplugin::ReadBytes(unsigned int address, unsigned int count)
411 411 {
412 412 unsigned int data[(count/4)+1];
413 413 QVariantList result;
414 414 this->Read(data,(count/4)+1,address);
415 415 for(unsigned int i = 0;i<count/4;i++)
416 416 {
417 417 result.append(QVariant((int)(0x0FF&(data[i]>>24))));
418 418 result.append(QVariant((int)(0x0FF&(data[i]>>16))));
419 419 result.append(QVariant((int)(0x0FF&(data[i]>>8))));
420 420 result.append(QVariant((int)(0x0FF&(data[i]))));
421 421 }
422 422
423 423 for(int i=0;i<(count%4);i++)
424 424 {
425 425 result.append(QVariant((int)(0x0FF&(data[count/4]>>((3-i)*8)))));
426 426 }
427 427
428 428 return result;
429 429 }
430 430
431 431 void ahbuartplugin::WriteBytes(unsigned int address, QList<QVariant> dataList)
432 432 {
433 433 unsigned int data[dataList.count()/4];
434 434 for(int i = 0;i<(dataList.count()/4);i++)
435 435 {
436 436 data[i] = 0x0FF & ((unsigned int)dataList.at(4*i).toUInt());
437 437 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+1).toUInt()));
438 438 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+2).toUInt()));
439 439 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+3).toUInt()));
440 440 }
441 441 this->Write(data,dataList.count()/4,address);
442 442 }
443 443
444 444
445 445
446 446
447 447
448 448
449 449
450 450
451 451
452 452
453 453
454 454
455 455
456 456
457 457
458 458
459 459
@@ -1,133 +1,133
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 AHBUARTPLUGIN_H
23 23 #define AHBUARTPLUGIN_H
24 24 #include <QMenuBar>
25 25 #include <QMenu>
26 26 #include <QAction>
27 27 #include <QLayout>
28 28 #include <QMutex>
29 29 #include <QProgressDialog>
30 30 #include <QStringListModel>
31 31 #include <QTime>
32 32 #include <socexplorerplugin.h>
33 33 #include "ahbuartpluginui.h"
34 34
35 35 #ifdef WinRs232
36 36 #include "librs232/RS232.h"
37 37 #else
38 38 #include <RS232.h>
39 39 #undef debug
40 40 #endif
41 41
42 42
43 43
44 44
45 45 #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message)
46 46
47 47 #define APENDTABLETOLOG(table,size,Qstr,message) \
48 48 Qstr.clear();\
49 49 Qstr+=message;\
50 50 for(int __i__tbllog__=0;(unsigned int)__i__tbllog__<size;__i__tbllog__++)\
51 51 {\
52 52 if(__i__tbllog__%16==0) Qstr += "\n"; \
53 53 Qstr += "0x" + QString::number((int)(0xff & table[__i__tbllog__]),16) +"\t";\
54 54 }\
55 55 APPENDTOLOG(Qstr);
56 56
57 57
58 58 #define SAFEWRITE(data,count,timer,timeout,error) \
59 59 while(1)\
60 60 {\
61 61 unsigned int __writen__=0; \
62 62 (timer).restart(); \
63 63 while(__writen__!=(count)) \
64 64 {\
65 65 __writen__ += rs232write(this->port,((data)+__writen__),((count)-__writen__)); \
66 66 if((timer).elapsed()>(timeout)) \
67 67 {\
68 68 APPENDTOLOG(QString("Timeout error while writing"));\
69 69 this->port = (rs232port_t)NULL; \
70 70 this->Connected = false; \
71 71 emit this->activateSig(false); \
72 72 error; \
73 73 } \
74 74 } \
75 75 break;\
76 76 }
77 77
78 78
79 79 #define SAFEREAD(data,count,timer,timeout,error) \
80 80 unsigned int __read__=0; \
81 81 (timer).restart(); \
82 82 while(__read__ != (count)) \
83 83 { \
84 84 __read__+=rs232read(this->port,((data)+__read__),((count)-__read__)); \
85 85 if((timer).elapsed()>(timeout)) \
86 86 { \
87 87 APPENDTOLOG(QString("Timeout error while reading"));\
88 88 this->Connected = false; \
89 89 emit this->activateSig(false); \
90 90 this->portMutex->unlock(); \
91 91 error; \
92 92 } \
93 93 } \
94 94
95 95
96 96
97 97 class ahbuartplugin : public socexplorerplugin
98 98 {
99 99 Q_OBJECT
100 100 public:
101 101 ahbuartplugin(QWidget *parent = 0);
102 102 ~ahbuartplugin();
103 103 int registermenu(QMainWindow *menuHolder);
104 104 int VID(){return driver_VID;}
105 105 int PID(){return driver_PID;}
106 106
107 107 public slots:
108 108 void togglePort(QString PortName,int baudrate);
109 109 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
110 110 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
111 111 void closeMe();
112 112 void close();
113 113 bool open(QString PortName,int baudrate);
114 114 void updatePortList();
115 115 QVariantList ReadBytes(unsigned int address,unsigned int count);
116 116 void WriteBytes(unsigned int address,QList<QVariant> dataList);
117 117 signals:
118 118 void setProgressValue(int progress);
119 119 private:
120 120 bool scanDone;
121 121 QProgressDialog* progress;
122 122 QLayout * mainLayout;
123 123 ahbUartPluginUI* UI;
124 124 QMutex* portMutex;
125 125 rs232port_t port;
126 126 QCompleter *portListcompleter;
127 127 QStringListModel *portListcompleterModel;
128 128 void connectPort(QString PortName,int baudrate);
129 129 bool checkConnection();
130 130
131 131 };
132 132
133 133 #endif // AHBUARTPLUGIN_H
@@ -1,124 +1,124
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "ahbuartpluginui.h"
23 23 #include "ui_ahbuartpluginui.h"
24 24
25 25 ahbUartPluginUI::ahbUartPluginUI(QWidget *parent) :
26 26 QWidget(parent),
27 27 ui(new Ui::ahbUartPluginUI)
28 28 {
29 29 ui->setupUi(this);
30 30 connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort()));
31 31 connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int)));
32 32 connect(ui->logFileChooseBp,SIGNAL(clicked()),this,SLOT(chooseLogFile()));
33 33 connect(this,SIGNAL(setLogFileName(QString)),this->ui->logFileName,SLOT(setText(QString)));
34 34 connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts()));
35 35 this->logFile = new QFile();
36 36 }
37 37
38 38 void ahbUartPluginUI::connectPort()
39 39 {
40 40 emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value());
41 41 }
42 42
43 43 void ahbUartPluginUI::setConnected(bool connected)
44 44 {
45 45 if(connected == true)
46 46 {
47 47 ui->OpenPort->setText(tr("Close port"));
48 48 }
49 49 else
50 50 ui->OpenPort->setText(tr("Open port"));
51 51 }
52 52
53 53
54 54 ahbUartPluginUI::~ahbUartPluginUI()
55 55 {
56 56 delete ui;
57 57 }
58 58
59 59
60 60 void ahbUartPluginUI::chooseLogFile()
61 61 {
62 62 if(this->logFile->isOpen())
63 63 this->logFile->close();
64 64 this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),QDir::homePath(), tr("Log Files (*.txt *.log)")));
65 65 if(this->logFile->open(QIODevice::WriteOnly))
66 66 {
67 67 this->logFileStrm = new QTextStream(this->logFile);
68 68 emit this->setLogFileName(this->logFile->fileName());
69 69 }
70 70 }
71 71
72 72 void ahbUartPluginUI::setconfig(QString PortName, int baudrate)
73 73 {
74 74 this->ui->PortName->setText(PortName);
75 75 this->ui->PortspeedSlider->setValue(baudrate);
76 76 }
77 77
78 78
79 79 void ahbUartPluginUI::logFileEnDisable(int state)
80 80 {
81 81 if(state==Qt::Checked)
82 82 {
83 83 this->logFileEn = true;
84 84 }
85 85 else if(state==Qt::Unchecked)
86 86 {
87 87 this->logFileEn = false;
88 88 }
89 89 }
90 90
91 91 bool ahbUartPluginUI::islogfileenable()
92 92 {
93 93 return this->logFileEn;
94 94 }
95 95
96 96 void ahbUartPluginUI::appendToLogFile(const QString & text)
97 97 {
98 98 if(this->logFileEn && this->logFile->isOpen())
99 99 {
100 100 *(this->logFileStrm) << text << endl;
101 101 }
102 102 }
103 103
104 104 void ahbUartPluginUI::setCompleter(QCompleter *completer)
105 105 {
106 106 this->ui->PortName->setCompleter(completer);
107 107 }
108 108
109 109 void ahbUartPluginUI::closeEvent(QCloseEvent *event)
110 110 {
111 111 if(this->logFile->isOpen())
112 112 {
113 113 this->logFileStrm->flush();
114 114 this->logFile->waitForBytesWritten(3000);
115 115 this->logFile->close();
116 116 }
117 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 AHBUARTPLUGINUI_H
23 23 #define AHBUARTPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QFile>
27 27 #include <QTextStream>
28 28 #include <QFileDialog>
29 29 #include <QDir>
30 30 #include <QCloseEvent>
31 31 #include <QCompleter>
32 32
33 33 namespace Ui {
34 34 class ahbUartPluginUI;
35 35 }
36 36
37 37 class ahbUartPluginUI : public QWidget
38 38 {
39 39 Q_OBJECT
40 40
41 41 public:
42 42 explicit ahbUartPluginUI(QWidget *parent = 0);
43 43 ~ahbUartPluginUI();
44 44 bool islogfileenable();
45 45 void appendToLogFile(const QString & text);
46 46 void closeEvent(QCloseEvent *event);
47 47 void setCompleter(QCompleter* completer);
48 48 public slots:
49 49 void setConnected(bool connected);
50 50 void connectPort();
51 51 void chooseLogFile();
52 52 void logFileEnDisable(int state);
53 53 void setconfig(QString PortName,int baudrate);
54 54
55 55 signals:
56 56 void connectPortsig(QString PortName,int baudrate);
57 57 void setLogFileName(QString FileName);
58 58 void rescanPorts();
59 59 private:
60 60 Ui::ahbUartPluginUI *ui;
61 61 QFile* logFile;
62 62 QTextStream* logFileStrm;
63 63 bool logFileEn;
64 64 };
65 65
66 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "ahbuartpywrapper.h"
23 23 #include <QObject>
24 24 #include <QFile>
25 25 #include <QTextStream>
26 26 #include <byteswap.h>
27 27 #include <stdint.h>
28 28
29 29 ahbuartPywrapper::ahbuartPywrapper(socexplorerplugin *parent) :
30 30 genericPySysdriver(parent)
31 31 {
32 32 }
@@ -1,74 +1,74
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "ahbdevicelist.h"
23 23
24 24
25 25
26 26 ahbdevicelist::ahbdevicelist(QWidget *parent):QTableWidget(parent)
27 27 {
28 28 this->setColumnCount(7);
29 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 32 void ahbdevicelist::clearAHBdevicesList()
33 33 {
34 34 this->clear();
35 35 this->setRowCount(0);
36 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 39 void ahbdevicelist::addAHBdevice(ahbdeviceInfo* device)
40 40 {
41 41 if(this->rowCount()==0)
42 42 {
43 43 this->setRowCount(1);
44 44 }
45 45 else
46 46 {
47 47 this->insertRow(this->rowCount());
48 48 }
49 49
50 50 this->ahbdevices.append(device);
51 51 QTableWidgetItem *newItem = new QTableWidgetItem(*device->deviceName);
52 52 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
53 53 this->setItem(this->rowCount()-1, 0, newItem);
54 54
55 55 for(int i=0;i<4;i++)
56 56 {
57 57 if(device->BAR[i].size!=0)
58 58 {
59 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 60 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
61 61 this->setItem(this->rowCount()-1, i+1, newItem);
62 62 }
63 63
64 64 }
65 65
66 66 newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16));
67 67 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
68 68 this->setItem(this->rowCount()-1, 5, newItem);
69 69 newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16));
70 70 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
71 71 this->setItem(this->rowCount()-1, 6, newItem);
72 72 this->resizeColumnsToContents();
73 73
74 74 }
@@ -1,104 +1,104
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 AHBDEVICELIST_H
23 23 #define AHBDEVICELIST_H
24 24 #include <QTableWidget>
25 25 #include <QString>
26 26 #include <QList>
27 27
28 28 typedef struct
29 29 {
30 30 unsigned int address;
31 31 unsigned int size;
32 32 unsigned char type;
33 33 bool prefectchable;
34 34 bool cacheable;
35 35
36 36 }AHBbarreg;
37 37
38 38 class ahbdeviceInfo
39 39 {
40 40 public:
41 41 ahbdeviceInfo()
42 42 {
43 43 }
44 44
45 45 ahbdeviceInfo(const QString deviceName,AHBbarreg BAR0,AHBbarreg BAR1, AHBbarreg BAR2,AHBbarreg BAR3,int VID,int PID)
46 46 {
47 47 this->deviceName = new QString(deviceName);
48 48 this->BAR[0]=BAR0;
49 49 this->BAR[1]=BAR1;
50 50 this->BAR[2]=BAR2;
51 51 this->BAR[3]=BAR3;
52 52 this->VID = VID;
53 53 this->PID = PID;
54 54 }
55 55 QString barAdressSize(int barIndex)
56 56 {
57 57 int k=0;
58 58 unsigned int size=this->BAR[barIndex].size;
59 59 while(size>=1024){size=size>>10;k++;}
60 60 switch(k)
61 61 {
62 62 case 0:
63 63 return (QString::number(size, 10) + "B");
64 64 break;
65 65 case 1:
66 66 return (QString::number(size, 10) + "kB");
67 67 break;
68 68 case 2:
69 69 return (QString::number(size, 10) + "MB");
70 70 break;
71 71 case 3:
72 72 return (QString::number(size, 10) + "GB");
73 73 break;
74 74 case 4:
75 75 return (QString::number(size, 10) + "TB");
76 76 break;
77 77 default:
78 78 return (QString::number(this->BAR[barIndex].size, 10) + "B");
79 79 break;
80 80 }
81 81 }
82 82 QString* deviceName;
83 83 AHBbarreg BAR[4];
84 84 int VID;
85 85 int PID;
86 86 };
87 87
88 88 class ahbdevicelist: public QTableWidget
89 89 {
90 90 Q_OBJECT
91 91 public:
92 92 explicit ahbdevicelist(QWidget * parent = 0);
93 93
94 94 public slots:
95 95 void addAHBdevice(ahbdeviceInfo* device);
96 96 void clearAHBdevicesList();
97 97
98 98 private:
99 99 QList<ahbdeviceInfo*> ahbdevices;
100 100
101 101
102 102 };
103 103
104 104 #endif // AHBDEVICELIST_H
@@ -1,90 +1,90
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "ahbpluginui.h"
23 23 #include <socexplorerengine.h>
24 24
25 25 ahbPluginUi::ahbPluginUi(socexplorerplugin *plugin, QWidget *parent) :
26 26 QWidget(parent)
27 27 {
28 28 this->mainlayout = new QHBoxLayout;
29 29 this->scanBp = new QPushButton(tr("Scan AHB"));
30 30 this->deviceslst = new ahbdevicelist;
31 31 this->mainlayout->addWidget(this->deviceslst);
32 32 this->mainlayout->addWidget(this->scanBp);
33 33 this->setLayout(this->mainlayout);
34 34 this->_plugin = plugin;
35 35 connect(this,SIGNAL(addAHBdevice(ahbdeviceInfo*)),this->deviceslst,SLOT(addAHBdevice(ahbdeviceInfo*)));
36 36 connect(this,SIGNAL(clearAHBdevicesList()),this->deviceslst,SLOT(clearAHBdevicesList()));
37 37 connect(this->scanBp,SIGNAL(clicked()),this,SLOT(scanAHB()));
38 38 }
39 39
40 40
41 41
42 42 ahbdeviceInfo* ahbPluginUi::extractInfos(int *pnpregs)
43 43 {
44 44 AHBbarreg BAR[4];
45 45
46 46 int VID;
47 47 int PID;
48 48 for(int i=0;i<4;i++)
49 49 {
50 50 BAR[i].address = pnpregs[i+4] & 0xfff00000;
51 51 BAR[i].size = (pnpregs[i+4] & 0x0000fff0)<<16;
52 52 if(BAR[i].size!=0)
53 53 BAR[i].size = (((-1^BAR[i].size)|BAR[i].address)-BAR[i].address)+1;
54 54 BAR[i].cacheable = (bool)((pnpregs[i+4]&0x00010000)>>16);
55 55 BAR[i].prefectchable = (bool)((pnpregs[i+4]&0x00020000)>>17);
56 56 BAR[i].type = (unsigned char)(pnpregs[i+4]&0xf);
57 57 }
58 58
59 59 VID = (pnpregs[0]>>24)&0xff;
60 60 PID = (pnpregs[0]>>12)&0xfff;
61 61 QString devname = SocExplorerEngine::getDevName(VID,PID);
62 62 return new ahbdeviceInfo(devname,BAR[0],BAR[1],BAR[2],BAR[3],VID,PID);
63 63 }
64 64
65 65
66 66 void ahbPluginUi::scanAHB()
67 67 {
68 68 unsigned int size = AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START;
69 69 int j=0;
70 70 unsigned long long i = AHB_PLUGNPLAY_MASTER_START;
71 71 int pnpregs[AHB_PLUGNPLAY_SLAVE_STOP- AHB_PLUGNPLAY_MASTER_START];
72 72 emit this->clearAHBdevicesList();
73 73 if( this->_plugin->Read((unsigned int*)pnpregs,size,(unsigned int)AHB_PLUGNPLAY_MASTER_START)==size)
74 74 {
75 75 while(i<AHB_PLUGNPLAY_SLAVE_STOP)
76 76 {
77 77 if(pnpregs[j]!=0)
78 78 {
79 79 ahbdeviceInfo* devinfo=this->extractInfos(pnpregs+j);
80 80 if(!devinfo->deviceName->compare("DSU3"))
81 81 SocExplorerEngine::addEnumDevice(this->_plugin,devinfo->VID,devinfo->PID,devinfo->BAR[0].address,*devinfo->deviceName);
82 82 emit this->addAHBdevice(devinfo);
83 83 }
84 84 i+=32;
85 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 AHBPLUGINUI_H
23 23 #define AHBPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QHBoxLayout>
27 27 #include <QPushButton>
28 28 #include "ahbdevicelist.h"
29 29 #include <socexplorerplugin.h>
30 30 #define AHB_PLUGNPLAY_MASTER_START ((unsigned int)(0xFFFFF000))
31 31 #define AHB_PLUGNPLAY_MASTER_STOP ((unsigned int)(0xFFFFF800))
32 32 #define AHB_PLUGNPLAY_SLAVE_START ((unsigned int)(0xFFFFF800))
33 33
34 34 #define AHB_PLUGNPLAY_SLAVE_STOP ((unsigned int)(0xFFFFFFFC))
35 35
36 36
37 37 class ahbPluginUi : public QWidget
38 38 {
39 39 Q_OBJECT
40 40 public:
41 41 explicit ahbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0);
42 42 ahbdeviceInfo* extractInfos(int* pnpregs);
43 43 public slots:
44 44 void scanAHB();
45 45 signals:
46 46 void addAHBdevice(ahbdeviceInfo* device);
47 47 void clearAHBdevicesList();
48 48 unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address);
49 49 unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address);
50 50 private:
51 51 QHBoxLayout* mainlayout;
52 52 QPushButton* scanBp;
53 53 ahbdevicelist* deviceslst;
54 54 socexplorerplugin* _plugin;
55 55
56 56
57 57 };
58 58
59 59 #endif // AHBPLUGINUI_H
@@ -1,74 +1,74
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "apbdevicelist.h"
23 23
24 24
25 25
26 26 apbdevicelist::apbdevicelist(QWidget *parent):QTableWidget(parent)
27 27 {
28 28 this->setColumnCount(4);
29 29 this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID"));
30 30 }
31 31
32 32 void apbdevicelist::clearAPBdevicesList()
33 33 {
34 34 this->clear();
35 35 this->setRowCount(0);
36 36 this->setHorizontalHeaderLabels(QStringList() << tr("Device Name")<<tr("BAR0")<<tr("Vendor ID")<<tr("Product ID"));
37 37 }
38 38
39 39 void apbdevicelist::addAPBdevice(apbdeviceInfo* device)
40 40 {
41 41 if(this->rowCount()==0)
42 42 {
43 43 this->setRowCount(1);
44 44 }
45 45 else
46 46 {
47 47 this->insertRow(this->rowCount());
48 48 }
49 49
50 50 this->apbdevices.append(device);
51 51 QTableWidgetItem *newItem = new QTableWidgetItem(device->deviceName);
52 52 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
53 53 this->setItem(this->rowCount()-1, 0, newItem);
54 54
55 55 for(int i=0;i<1;i++)
56 56 {
57 57 if(device->BAR[i].size!=0)
58 58 {
59 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 60 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
61 61 this->setItem(this->rowCount()-1, i+1, newItem);
62 62 }
63 63
64 64 }
65 65
66 66 newItem = new QTableWidgetItem("0x" + QString::number(device->VID , 16));
67 67 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
68 68 this->setItem(this->rowCount()-1, 2, newItem);
69 69 newItem = new QTableWidgetItem("0x" + QString::number(device->PID , 16));
70 70 newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable);
71 71 this->setItem(this->rowCount()-1, 3, newItem);
72 72 this->resizeColumnsToContents();
73 73
74 74 }
@@ -1,99 +1,99
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 APBDEVICELIST_H
23 23 #define APBDEVICELIST_H
24 24 #include <QTableWidget>
25 25 #include <QString>
26 26 #include <QList>
27 27
28 28 typedef struct
29 29 {
30 30 unsigned int address;
31 31 unsigned int size;
32 32 unsigned char type;
33 33
34 34 }APBbarreg;
35 35
36 36 class apbdeviceInfo
37 37 {
38 38 public:
39 39 apbdeviceInfo()
40 40 {
41 41 }
42 42
43 43 apbdeviceInfo(const QString deviceName,APBbarreg BAR0,int VID,int PID)
44 44 {
45 45 this->deviceName = deviceName;
46 46 this->BAR[0]=BAR0;
47 47 this->VID = VID;
48 48 this->PID = PID;
49 49 }
50 50 QString barAdressSize(int barIndex)
51 51 {
52 52 int k=0;
53 53 unsigned int size=this->BAR[barIndex].size;
54 54 while(size>=1024){size=size>>10;k++;}
55 55 switch(k)
56 56 {
57 57 case 0:
58 58 return (QString::number(size, 10) + "B");
59 59 break;
60 60 case 1:
61 61 return (QString::number(size, 10) + "kB");
62 62 break;
63 63 case 2:
64 64 return (QString::number(size, 10) + "MB");
65 65 break;
66 66 case 3:
67 67 return (QString::number(size, 10) + "GB");
68 68 break;
69 69 case 4:
70 70 return (QString::number(size, 10) + "TB");
71 71 break;
72 72 default:
73 73 return (QString::number(this->BAR[barIndex].size, 10) + "B");
74 74 break;
75 75 }
76 76 }
77 77 QString deviceName;
78 78 APBbarreg BAR[1];
79 79 int VID;
80 80 int PID;
81 81 };
82 82
83 83 class apbdevicelist: public QTableWidget
84 84 {
85 85 Q_OBJECT
86 86 public:
87 87 explicit apbdevicelist(QWidget * parent = 0);
88 88
89 89 public slots:
90 90 void addAPBdevice(apbdeviceInfo* device);
91 91 void clearAPBdevicesList();
92 92
93 93 private:
94 94 QList<apbdeviceInfo*> apbdevices;
95 95
96 96
97 97 };
98 98
99 99 #endif // APBDEVICELIST_H
@@ -1,99 +1,99
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "apbpluginui.h"
23 23 #include <stdint.h>
24 24 #include <socexplorerengine.h>
25 25
26 26 apbPluginUi::apbPluginUi(socexplorerplugin *plugin, QWidget *parent) :
27 27 QWidget(parent)
28 28 {
29 29 this->setWindowTitle(tr("APB Driver"));
30 30 this->mainlayout = new QHBoxLayout;
31 31 this->scanBp = new QPushButton(tr("Scan APB"));
32 32 this->deviceslst = new apbdevicelist;
33 33 this->mainlayout->addWidget(this->deviceslst);
34 34 this->mainlayout->addWidget(this->scanBp);
35 35 this->setLayout(this->mainlayout);
36 36 this->_plugin = plugin;
37 37 connect(this,SIGNAL(addAPBdevice(apbdeviceInfo*)),this->deviceslst,SLOT(addAPBdevice(apbdeviceInfo*)));
38 38 connect(this,SIGNAL(clearAPBdevicesList()),this->deviceslst,SLOT(clearAPBdevicesList()));
39 39 connect(this->scanBp,SIGNAL(clicked()),this,SLOT(scanAPB()));
40 40 }
41 41
42 42 void apbPluginUi::lockScanBp()
43 43 {
44 44 this->scanBp->setEnabled(false);
45 45 }
46 46
47 47
48 48 void apbPluginUi::unlockScanBp()
49 49 {
50 50 this->scanBp->setEnabled(true);
51 51 }
52 52
53 53
54 54
55 55 apbdeviceInfo* apbPluginUi::extractInfos(int *pnpregs)
56 56 {
57 57 APBbarreg BAR[1];
58 58
59 59 int VID;
60 60 int PID;
61 61 for(int i=0;i<1;i++)
62 62 {
63 63 BAR[i].address = ((uint32_t)(pnpregs[i+1] & 0xfff00000)>>12)+ APB_BUS_START;
64 64 BAR[i].size = ((pnpregs[i+1] & 0x00000ff0)>>4 )+1;
65 65 BAR[i].type = (unsigned char)(pnpregs[i+1]&0xf);
66 66 }
67 67
68 68 VID = (pnpregs[0]>>24)&0xff;
69 69 PID = (pnpregs[0]>>12)&0xfff;
70 70 QString devname = SocExplorerEngine::getDevName(VID,PID);
71 71 return new apbdeviceInfo(devname,BAR[0],VID,PID);
72 72 }
73 73
74 74 void apbPluginUi::scanAPB()
75 75 {
76 76 this->lockScanBp();
77 77 unsigned int size = APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START;
78 78 int j=0;
79 79 unsigned long long i = APB_PLUGNPLAY_START;
80 80 int pnpregs[APB_PLUGNPLAY_STOP - APB_PLUGNPLAY_START];
81 81 emit this->clearAPBdevicesList();
82 82 if(this->_plugin->Read((unsigned int*)pnpregs,size/4,(unsigned int)APB_PLUGNPLAY_START)==(size/4))
83 83 {
84 84 while(i<APB_PLUGNPLAY_STOP)
85 85 {
86 86 if(pnpregs[j]!=0)
87 87 {
88 88 apbdeviceInfo* devinfos=this->extractInfos(pnpregs+j);
89 89 SocExplorerEngine::addEnumDevice(this->_plugin,devinfos->VID,devinfos->PID,devinfos->BAR[0].address,devinfos->deviceName);
90 90 emit this->addAPBdevice(devinfos);
91 91 }
92 92 i+=8;
93 93 j+=2;
94 94 if(pnpregs[0]==pnpregs[j]&&pnpregs[1]==pnpregs[j+1])break;
95 95 }
96 96 }
97 97 this->unlockScanBp();
98 98 }
99 99
@@ -1,60 +1,60
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 APBPLUGINUI_H
23 23 #define APBPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QHBoxLayout>
27 27 #include <QPushButton>
28 28 #include "apbdevicelist.h"
29 29 #include <socexplorerplugin.h>
30 30
31 31 #define APB_BUS_START ((unsigned int)(0x80000000))
32 32 #define APB_PLUGNPLAY_START ((unsigned int)(0x800FF000))
33 33
34 34 #define APB_PLUGNPLAY_STOP ((unsigned int)(0x800FF000+(512*8)))
35 35
36 36
37 37 class apbPluginUi : public QWidget
38 38 {
39 39 Q_OBJECT
40 40 public:
41 41 explicit apbPluginUi(socexplorerplugin* plugin,QWidget *parent = 0);
42 42 void lockScanBp();
43 43 void unlockScanBp();
44 44 apbdeviceInfo* extractInfos(int* pnpregs);
45 45
46 46 signals:
47 47 void addAPBdevice(apbdeviceInfo* device);
48 48 void clearAPBdevicesList();
49 49 unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address);
50 50 unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address);
51 51 public slots:
52 52 void scanAPB();
53 53 private:
54 54 QHBoxLayout* mainlayout;
55 55 QPushButton* scanBp;
56 56 apbdevicelist* deviceslst;
57 57 socexplorerplugin* _plugin;
58 58 };
59 59
60 60 #endif // APBPLUGINUI_H
@@ -1,93 +1,93
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2012, Laboratory of Plasmas Physic - 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 "ambaplugin.h"
23 23
24 24
25 25 ambaplugin::ambaplugin(QWidget *parent):socexplorerplugin(parent,true)
26 26 {
27 27 this->UI = new ambaPluginUI(this);
28 28 this->setWindowTitle(tr("AMBA Driver"));
29 29 this->setWidget((QWidget*)this->UI);
30 30 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
31 31 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
32 32 connect(this,SIGNAL(activateSig(bool)),this,SLOT(activatePlugin(bool)));
33 33 }
34 34
35 35
36 36 ambaplugin::~ambaplugin()
37 37 {
38 38
39 39 }
40 40
41 41
42 42 void ambaplugin::closeMe()
43 43 {
44 44 emit this->closePlugin(this);
45 45 }
46 46
47 47 void ambaplugin::postInstantiationTrigger()
48 48 {
49 49 if(this->parent->isConnected())
50 50 {
51 51 this->UI->scanAll();
52 52 }
53 53 }
54 54
55 55 void ambaplugin::activatePlugin(bool flag)
56 56 {
57 57 if(flag)
58 58 {
59 59 this->UI->scanAll();
60 60 }
61 61 }
62 62
63 63 int ambaplugin::registermenu(QMainWindow *menuHolder)
64 64 {
65 65 this->menu = menuHolder->menuBar()->addMenu(tr("&ambaplugin"));
66 66 this->closeAction = this->menu->addAction(tr("Close plugin"));
67 67 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
68 68 return 1;
69 69 }
70 70
71 71
72 72
73 73 unsigned int ambaplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
74 74 {
75 75 if(parent!=NULL)
76 76 return parent->Read(Value,count,address);
77 77 return 0;
78 78 }
79 79
80 80 unsigned int ambaplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
81 81 {
82 82 if(parent!=NULL)
83 83 return parent->Write(Value,count,address);
84 84 return 0;
85 85 }
86 86
87 87
88 88
89 89
90 90
91 91
92 92
93 93
@@ -1,56 +1,56
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2012, Laboratory of Plasmas Physic - 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 ambaplugin_H
23 23 #define ambaplugin_H
24 24 #include <QMenuBar>
25 25 #include <QMenu>
26 26 #include <QAction>
27 27 #include <QLayout>
28 28 #include "ambapluginui.h"
29 29 #include <socexplorerplugin.h>
30 30
31 31
32 32
33 33 class ambaplugin : public socexplorerplugin
34 34 {
35 35 Q_OBJECT
36 36 public:
37 37 explicit ambaplugin(QWidget *parent = 0);
38 38 ~ambaplugin();
39 39 int registermenu(QMainWindow *menuHolder);
40 40 int VID(){return driver_VID;}
41 41 int PID(){return driver_PID;}
42 42
43 43 public slots:
44 44 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
45 45 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
46 46 void closeMe();
47 47 void postInstantiationTrigger();
48 48 void activatePlugin(bool flag);
49 49 signals:
50 50
51 51 private:
52 52 ambaPluginUI* UI;
53 53 };
54 54
55 55 #endif // ambaplugin_H
56 56
@@ -1,43 +1,43
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2012, Laboratory of Plasmas Physic - 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 "ambapluginui.h"
23 23
24 24 ambaPluginUI::ambaPluginUI(socexplorerplugin *plugin, QWidget *parent) :
25 25 QWidget(parent)
26 26 {
27 27 this->mainLayout=new QGridLayout();
28 28 this->ahbPlugin=new ahbPluginUi(plugin);
29 29 this->apbPlugin=new apbPluginUi(plugin);
30 30 this->mainLayout->addWidget(this->ahbPlugin,0,0,1,-1);
31 31 this->mainLayout->addWidget(this->apbPlugin,1,0,1,-1);
32 32 this->setLayout(this->mainLayout);
33 33 connect(this->ahbPlugin,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint)));
34 34 connect(this->ahbPlugin,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint)));
35 35 connect(this->apbPlugin,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint)));
36 36 connect(this->apbPlugin,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint)));
37 37 }
38 38
39 39 void ambaPluginUI::scanAll()
40 40 {
41 41 this->ahbPlugin->scanAHB();
42 42 this->apbPlugin->scanAPB();
43 43 }
@@ -1,49 +1,49
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2012, Laboratory of Plasmas Physic - 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 AMBAPLUGINUI_H
23 23 #define AMBAPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QVBoxLayout>
27 27 #include <QGridLayout>
28 28 #include <QPushButton>
29 29 #include "AHB/ahbpluginui.h"
30 30 #include "APB/apbpluginui.h"
31 31
32 32 class ambaPluginUI : public QWidget
33 33 {
34 34 Q_OBJECT
35 35 public:
36 36 explicit ambaPluginUI(socexplorerplugin* plugin,QWidget *parent = 0);
37 37
38 38 signals:
39 39 unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address);
40 40 unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address);
41 41 public slots:
42 42 void scanAll();
43 43 private:
44 44 QGridLayout* mainLayout;
45 45 ahbPluginUi* ahbPlugin;
46 46 apbPluginUi* apbPlugin;
47 47 };
48 48
49 49 #endif // AMBAPLUGINUI_H
@@ -1,226 +1,226
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "dsu3plugin.h"
23 23 #include <QFileDialog>
24 24 #include <QDir>
25 25 #include "dsu3pluginpywrapper.h"
26 26 #include <socexplorerengine.h>
27 27
28 28 dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false)
29 29 {
30 30 this->UI = new dsu3pluginui();
31 31 this->setWindowTitle(tr("DSU3 Driver"));
32 32 this->setWidget((QWidget*)this->UI);
33 33 this->elfparserInst = new elfparser();
34 34 this->pyObject = new dsu3pluginPywrapper(this);
35 35 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString)));
36 36 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
37 37 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
38 38 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
39 39 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
40 40 connect(this->UI,SIGNAL(run()),this,SLOT(run()));
41 41 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
42 42 }
43 43
44 44
45 45 dsu3plugin::~dsu3plugin()
46 46 {
47 47
48 48 }
49 49
50 50
51 51 void dsu3plugin::openFile()
52 52 {
53 53 QString filename = QFileDialog::getOpenFileName(this,tr("Open elf File"), QDir::homePath(), tr("Elf Files (*)"));
54 54 if(filename!="")
55 55 {
56 56 this->openFile(filename);
57 57 }
58 58 }
59 59
60 60 void dsu3plugin::openFile(QString fileName)
61 61 {
62 62 this->elfparserInst->setFilename(fileName);
63 63 emit this->updateInfo(this->elfparserInst);
64 64 }
65 65
66 66 bool dsu3plugin::configureTarget()
67 67 {
68 68 if(parent==NULL)
69 69 return false;
70 70 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
71 71 if(DSUBASEADDRESS == (unsigned int)-1)
72 72 DSUBASEADDRESS = 0x90000000;
73 73 unsigned int MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x04 , 0x00F,0);
74 74 if(MCTRLBASEADDRESS == (unsigned int)-1)
75 75 return false;
76 76
77 77 //Force a debug break
78 78 WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS);
79 79 WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20);
80 80 //Clear time tag counter
81 81 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8);
82 82
83 83 //Clear ASR registers
84 84 WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040);
85 85 WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024);
86 86 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
87 87 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48);
88 88 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
89 89 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
90 90
91 91
92 92
93 93 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
94 94
95 95
96 96 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
97 97 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
98 98
99 99 unsigned int buff=0;
100 100 // for(int i=0;i<1567;i++)
101 101 // {
102 102 // parent->Write(&buff,(unsigned int)1,DSUBASEADDRESS+0x300000+(4*i));
103 103 // }
104 104 memSet(DSUBASEADDRESS+0x300000,0,1567);
105 105 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
106 106 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);
107 107 WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS);
108 108
109 109 //Disable interrupts
110 110 unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0);
111 111 if(APBIRQCTRLRBASEADD == (unsigned int)-1)
112 112 return false;
113 113 WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040);
114 114 WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080);
115 115 WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD);
116 116
117 117 //Set up timer
118 118 unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0);
119 119 if(APBTIMERBASEADD == (unsigned int)-1)
120 120 return false;
121 121 WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014);
122 122 WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04);
123 123 WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018);
124 124 return true;
125 125 }
126 126
127 127 bool dsu3plugin::flashTarget()
128 128 {
129 129 configureTarget();
130 130
131 131 /*Write .text*/
132 132 this->writeSection(".text");
133 133 /*Write .data*/
134 134 this->writeSection(".data");
135 135 return true;
136 136 }
137 137
138 138 void dsu3plugin::run()
139 139 {
140 140 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
141 141 if(DSUBASEADDRESS == (unsigned int)-1)
142 142 DSUBASEADDRESS = 0x90000000;
143 143 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
144 144 }
145 145
146 146 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
147 147 {
148 148 unsigned int* buff;
149 149 buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int));
150 150 for(int i=0;i<Values.count();i++)
151 151 {
152 152 buff[i]=Values.at(i);
153 153 }
154 154 parent->Write(buff,(unsigned int)Values.count(),address);
155 155 free(buff);
156 156 }
157 157
158 158 void dsu3plugin::writeSection(int index)
159 159 {
160 160 char* buffch=NULL;
161 161 unsigned int* buff;
162 162 int size = this->elfparserInst->getSectionDatasz(index);
163 163 int sizeInt = size/4;
164 164 if(parent==NULL)
165 165 return;
166 166 this->elfparserInst->getSectionData(index,&buffch);
167 167 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
168 168 for(int i=0;i<sizeInt;i++)
169 169 {
170 170 buff[i] = 0x0FF & ((unsigned int)buffch[4*i]);
171 171 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1]));
172 172 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2]));
173 173 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3]));
174 174 }
175 175 if(size%4)
176 176 {
177 177 buff[sizeInt]=0;
178 178 for(int i=(size%4);i>0;i--)
179 179 {
180 180 buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i]));
181 181 }
182 182 sizeInt++;
183 183 }
184 184 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index));
185 185 free(buff);
186 186 }
187 187
188 188 void dsu3plugin::writeSection(const QString &name)
189 189 {
190 190 for(int i=0;i<this->elfparserInst->getSectioncount();i++)
191 191 {
192 192 if(!this->elfparserInst->getSectionName(i).compare(name))
193 193 {
194 194 printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i));
195 195 writeSection(i);
196 196 }
197 197 }
198 198 }
199 199
200 200
201 201 unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
202 202 {
203 203 if(parent!=NULL)
204 204 return parent->Write(Value,count,address);
205 205 return 0;
206 206 }
207 207
208 208 bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count)
209 209 {
210 210 unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int));
211 211 if(buffer!=NULL)
212 212 {
213 213 memset((void*)buffer,value,count*sizeof(unsigned int));
214 214 parent->Write(buffer,count,address);
215 215 free(buffer );
216 216 return true;
217 217 }
218 218 return false;
219 219 }
220 220
221 221 unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address)
222 222 {
223 223 if(parent!=NULL)
224 224 return parent->Read(Value,count,address);
225 225 return 0;
226 226 }
@@ -1,61 +1,61
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2012, Laboratory of Plasmas Physic - 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 DSU3PLUGIN_H
23 23 #define DSU3PLUGIN_H
24 24 #include "dsu3pluginui.h"
25 25 #include <QMenuBar>
26 26 #include <QMenu>
27 27 #include <QAction>
28 28 #include <QMainWindow>
29 29 #include <QList>
30 30 #include "elfparser.h"
31 31 #include <socexplorerplugin.h>
32 32 #include <socexplorerengine.h>
33 33
34 34 typedef QList<unsigned int> uIntlist;
35 35
36 36 class dsu3plugin : public socexplorerplugin
37 37 {
38 38 Q_OBJECT
39 39 public:
40 40 explicit dsu3plugin(QWidget *parent = 0);
41 41 ~dsu3plugin();
42 42 bool memSet(unsigned int address, int value, unsigned int count);
43 43 public slots:
44 44 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
45 45 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
46 46 void openFile();
47 47 void openFile(QString fileName);
48 48 bool configureTarget();
49 49 bool flashTarget();
50 50 void run();
51 51 signals:
52 52 void updateInfo(elfparser* parser);
53 53 private:
54 54 void WriteRegs(uIntlist Values, unsigned int address);
55 55 void writeSection(int index);
56 56 void writeSection(const QString& name);
57 57 dsu3pluginui* UI;
58 58 elfparser* elfparserInst;
59 59 };
60 60
61 61 #endif // DSU3PLUGIN_H
@@ -1,54 +1,54
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Laboratory of Plasmas Physic - 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
23 23 #include <dsu3pluginui.h>
24 24
25 25 dsu3pluginui::dsu3pluginui(QWidget *parent)
26 26 :QWidget(parent)
27 27 {
28 28 this->openFileQpb = new QPushButton(tr("Open File"));
29 29 this->flashTargetQpb = new QPushButton(tr("Flash Target"));
30 30 this->runQpb = new QPushButton(tr("Run"));
31 31 this->mainLayout = new QGridLayout();
32 32 this->elfInfoWdgtInst = new elfInfoWdgt;
33 33 this->mainLayout->addWidget(this->openFileQpb,0,0,1,1);
34 34 this->mainLayout->addWidget(this->flashTargetQpb,0,1,1,1);
35 35 this->mainLayout->addWidget(this->runQpb,0,2,1,1);
36 36 this->mainLayout->addWidget(this->elfInfoWdgtInst,1,0,1,-1);
37 37 this->setLayout(this->mainLayout);
38 38 connect(this->openFileQpb,SIGNAL(clicked()),this,SIGNAL(openFile()));
39 39 connect(this->flashTargetQpb,SIGNAL(clicked()),this,SIGNAL(flashTarget()));
40 40 connect(this->runQpb,SIGNAL(clicked()),this,SIGNAL(run()));
41 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2012, Laboratory of Plasmas Physic - 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 DSU3PLUGINUI_H
23 23 #define DSU3PLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QHBoxLayout>
27 27 #include <QPushButton>
28 28 #include <qhexedit.h>
29 29 #include <QSplitter>
30 30 #include <QVBoxLayout>
31 31 #include <QGridLayout>
32 32 #include "elfinfowdgt.h"
33 33
34 34 class dsu3pluginui : public QWidget
35 35 {
36 36 Q_OBJECT
37 37 public:
38 38 explicit dsu3pluginui(QWidget *parent = 0);
39 39
40 40 public slots:
41 41
42 42 signals:
43 43 void openFile();
44 44 void updateInfo(elfparser* parser);
45 45 bool flashTarget();
46 46 void run();
47 47 private:
48 48 QGridLayout* mainLayout;
49 49 QPushButton* openFileQpb;
50 50 QPushButton* flashTargetQpb;
51 51 QPushButton* runQpb;
52 52 elfInfoWdgt* elfInfoWdgtInst;
53 53
54 54 };
55 55
56 56 #endif // DSU3PLUGINUI_H
57 57
58 58
@@ -1,62 +1,62
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "genericrwplugin.h"
23 23 #include "genericrwpluginpywrapper.h"
24 24 genericrwplugin::genericrwplugin(QWidget *parent):socexplorerplugin(parent,false)
25 25 {
26 26 this->UI = new genericrwpluginUi();
27 27 this->setWindowTitle(tr("Generic Driver"));
28 28 this->setWidget((QWidget*)this->UI);
29 29 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
30 30 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
31 31 this->pyObject = new genericRWpluginPyWrapper(this);
32 32 //QObject::connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
33 33 //QObject::connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
34 34 QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(refresh()),this->UI,SIGNAL(refresh()));
35 35 QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setAddress(quint32)),this->UI,SIGNAL(setAddress(quint32)));
36 36 QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setLength(quint32)),this->UI,SIGNAL(setLength(quint32)));
37 37 }
38 38
39 39 genericrwplugin::~genericrwplugin()
40 40 {}
41 41
42 42 int genericrwplugin::registermenu(QMainWindow *menuHolder)
43 43 {
44 44 this->menu = menuHolder->menuBar()->addMenu(tr("&Generic RW Driver"));
45 45 this->closeAction = this->menu->addAction(tr("Close plugin"));
46 46 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
47 47 return 1;
48 48 }
49 49
50 50 unsigned int genericrwplugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
51 51 {
52 52 if(parent!=NULL)
53 53 return parent->Write(Value,count,address);
54 54 return 0;
55 55 }
56 56
57 57 unsigned int genericrwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
58 58 {
59 59 if(parent!=NULL)
60 60 return parent->Read(Value,count,address);
61 61 return 0;
62 62 }
@@ -1,56 +1,56
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 GENERICRWPLUGIN_H
23 23 #define GENERICRWPLUGIN_H
24 24 #include "genericrwpluginui.h"
25 25 #include <QMenuBar>
26 26 #include <QMenu>
27 27 #include <QAction>
28 28 #include <QMainWindow>
29 29
30 30
31 31
32 32 #include <socexplorerplugin.h>
33 33
34 34 #define AHB_PLUGNPLAY_MASTER_START 0xFFFFF000
35 35 #define AHB_PLUGNPLAY_MASTER_STOP 0xFFFFF800
36 36 #define AHB_PLUGNPLAY_SLAVE_START 0xFFFFF800
37 37 #define AHB_PLUGNPLAY_SLAVE_STOP 0xFFFFFFFC
38 38
39 39
40 40 class genericrwplugin : public socexplorerplugin
41 41 {
42 42 Q_OBJECT
43 43 public:
44 44 explicit genericrwplugin(QWidget *parent = 0);
45 45 ~genericrwplugin();
46 46 int registermenu(QMainWindow *menuHolder);
47 47 public slots:
48 48 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
49 49 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
50 50 signals:
51 51
52 52 private:
53 53 genericrwpluginUi* UI;
54 54 };
55 55
56 56 #endif // GENERICRWPLUGIN_H
@@ -1,27 +1,27
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "genericrwpluginpywrapper.h"
23 23
24 24 genericRWpluginPyWrapper::genericRWpluginPyWrapper(socexplorerplugin *parent) :
25 25 genericPySysdriver(parent)
26 26 {
27 27 }
@@ -1,40 +1,40
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - 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@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef GENERICRWPLUGINPYWRAPPER_H
23 23 #define GENERICRWPLUGINPYWRAPPER_H
24 24 #include <genericPySysdriver.h>
25 25 class genericRWpluginPyWrapper : public genericPySysdriver
26 26 {
27 27 Q_OBJECT
28 28 public:
29 29 explicit genericRWpluginPyWrapper(socexplorerplugin *parent = 0);
30 30
31 31 signals:
32 32 void refresh();
33 33 void setAddress(quint32 address);
34 34 void setLength(quint32 length);
35 35
36 36 public slots:
37 37
38 38 };
39 39
40 40 #endif // GENERICRWPLUGINPYWRAPPER_H
@@ -1,41 +1,41
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "genericrwplugin.h"
23 23
24 24 genericrwpluginUi::genericrwpluginUi(QWidget *parent) :
25 25 QWidget(parent)
26 26 {
27 27
28 28 this->mainlayout = new QHBoxLayout;
29 29 this->tabWdgt = new QTabWidget;
30 30 this->mainlayout->addWidget(this->tabWdgt);
31 31 this->memEditorWdgt = new memEditor;
32 32 this->tabWdgt->addTab(this->memEditorWdgt,tr("Memory editor"));
33 33 this->setLayout(this->mainlayout);
34 34 connect(this->memEditorWdgt,SIGNAL(WriteSig(uint*,uint,uint)),this,SIGNAL(WriteSig(uint*,uint,uint)));
35 35 connect(this->memEditorWdgt,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint)));
36 36 connect(this,SIGNAL(refresh()),this->memEditorWdgt,SLOT(readMemSlt()));
37 37 connect(this,SIGNAL(setAddress(quint32)),this->memEditorWdgt,SLOT(setAddress(quint32)));
38 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 AHBPLUGINUI_H
23 23 #define AHBPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QHBoxLayout>
27 27 #include <QTabWidget>
28 28 #include <QPushButton>
29 29 #include "memeditor.h"
30 30 #include <QSplitter>
31 31
32 32
33 33 class genericrwpluginUi : public QWidget
34 34 {
35 35 Q_OBJECT
36 36 public:
37 37 explicit genericrwpluginUi(QWidget *parent = 0);
38 38
39 39 signals:
40 40 unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address);
41 41 unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address);
42 42 void refresh();
43 43 void setAddress(quint32 address);
44 44 void setLength(quint32 length);
45 45
46 46 private:
47 47 QSplitter* verticalSpliter;
48 48 QHBoxLayout* mainlayout;
49 49 QTabWidget* tabWdgt;
50 50 memEditor* memEditorWdgt;
51 51
52 52 };
53 53
54 54 #endif // AHBPLUGINUI_H
@@ -1,98 +1,98
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "memeditor.h"
23 23 #include "malloc.h"
24 24
25 25 memEditor::memEditor(QWidget *parent) :
26 26 QWidget(parent)
27 27 {
28 28 this->verticalSpliter = new QSplitter;
29 29 this->ctrlWidget = new QWidget;
30 30 this->verticalSpliter->setOrientation(Qt::Horizontal);
31 31 this->mainLayout = new QHBoxLayout;
32 32 this->ctrlLayout = new QVBoxLayout;
33 33 this->hexEditor = new QHexEdit;
34 34 this->addressSpnBx = new QHexSpinBox;
35 35 this->SizeWidget = new MemSizeWdgt(256);
36 36 this->readMemQPb = new QPushButton(tr("Read Mem"));
37 37 this->writeMemQPb = new QPushButton(tr("Write Mem"));
38 38 this->ctrlLayout->addWidget(this->addressSpnBx);
39 39 this->ctrlLayout->addWidget(this->SizeWidget);
40 40 this->ctrlLayout->addWidget(this->readMemQPb);
41 41 this->ctrlLayout->addWidget(this->writeMemQPb);
42 42 this->ctrlWidget->setLayout(this->ctrlLayout);
43 43 this->verticalSpliter->addWidget(this->hexEditor);
44 44 this->verticalSpliter->addWidget(this->ctrlWidget);
45 45 this->mainLayout->addWidget(this->verticalSpliter);
46 46 this->setLayout(this->mainLayout);
47 47 connect(this->readMemQPb,SIGNAL(clicked()),this,SLOT(readMemSlt()));
48 48 connect(this->writeMemQPb,SIGNAL(clicked()),this,SLOT(writeMemSlt()));
49 49 this->SizeWidget->setMaximum(16384);
50 50 }
51 51
52 52 void memEditor::writeMemSlt()
53 53 {
54 54
55 55 QByteArray data = this->hexEditor->data();
56 56 unsigned int length = data.length()/4;
57 57 unsigned int* buffer=(unsigned int*)malloc(length*sizeof(int));
58 58 unsigned int address = this->hexEditor->addressOffset();
59 59 for(int i=0;(unsigned int)i<length;i++)
60 60 {
61 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 63 emit this->WriteSig(buffer,length,address);
64 64 free(buffer);
65 65 }
66 66
67 67 void memEditor::setAddress(quint32 address)
68 68 {
69 69 this->addressSpnBx->setValue(address);
70 70 }
71 71
72 72 void memEditor::setLength(quint32 length)
73 73 {
74 74 this->SizeWidget->setSizeValue(length);
75 75 }
76 76
77 77 void memEditor::readMemSlt()
78 78 {
79 79 this->SizeWidget->updateSizeValue();
80 80 unsigned int size = this->SizeWidget->getsize()/4;
81 81 unsigned int buffer[16384];
82 82 unsigned char buffChar[16384*4];
83 83 unsigned int address = this->addressSpnBx->value();
84 84 if((emit this->ReadSig(buffer,size,address&(-4)))==size)
85 85 {
86 86 for(int i=0;(unsigned int)i<size;i++)
87 87 {
88 88 buffChar[4*i]=(buffer[i]>>24)&0xFF;
89 89 buffChar[(4*i)+1]=(buffer[i]>>16)&0xFF;
90 90 buffChar[(4*i)+2]=(buffer[i]>>8)&0xFF;
91 91 buffChar[(4*i)+3]=(buffer[i])&0xFF;
92 92 }
93 93 QByteArray data = QByteArray((char*)buffChar,size*4);
94 94 this->hexEditor->setData(data);
95 95 this->hexEditor->setAddressOffset(address&(-4));
96 96 this->addressSpnBx->setValue(address&(-4));
97 97 }
98 98 }
@@ -1,62 +1,62
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 MEMEDITOR_H
23 23 #define MEMEDITOR_H
24 24
25 25 #include <QWidget>
26 26 #include <QVBoxLayout>
27 27 #include <QHBoxLayout>
28 28 #include <QPushButton>
29 29 #include <QByteArray>
30 30 #include <QSplitter>
31 31 #include <qhexedit.h>
32 32 #include <qhexspinbox.h>
33 33 #include <memsizewdgt.h>
34 34
35 35 class memEditor : public QWidget
36 36 {
37 37 Q_OBJECT
38 38 public:
39 39 explicit memEditor(QWidget *parent = 0);
40 40
41 41 signals:
42 42 unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address);
43 43 unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address);
44 44
45 45 public slots:
46 46 void readMemSlt();
47 47 void writeMemSlt();
48 48 void setAddress(quint32 address);
49 49 void setLength(quint32 length);
50 50 private:
51 51 QWidget* ctrlWidget;
52 52 QSplitter* verticalSpliter;
53 53 QHBoxLayout* mainLayout;
54 54 QVBoxLayout* ctrlLayout;
55 55 QHexEdit* hexEditor;
56 56 QHexSpinBox* addressSpnBx;
57 57 QPushButton* readMemQPb;
58 58 QPushButton* writeMemQPb;
59 59 MemSizeWdgt* SizeWidget;
60 60 };
61 61
62 62 #endif // MEMEDITOR_H
@@ -1,86 +1,86
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "memctrlrplugin.h"
23 23 #include "memctrlrpywrapper.h"
24 24
25 25 memctrlrplugin::memctrlrplugin(QWidget *parent):socexplorerplugin(parent,false)
26 26 {
27 27 this->UI = new memctrlrPluginUi();
28 28 this->setWindowTitle(tr("Memctrlr Driver"));
29 29 this->setWidget((QWidget*)this->UI);
30 30 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
31 31 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
32 32 this->pyObject = new memctrlrPyWrapper(this);
33 33 connect(this->pyObject,SIGNAL(launchTest(uint,uint)),this,SLOT(launchTest(uint,uint)));
34 34 }
35 35
36 36 memctrlrplugin::~memctrlrplugin()
37 37 {}
38 38
39 39 int memctrlrplugin::registermenu(QMainWindow *menuHolder)
40 40 {
41 41 this->menu = menuHolder->menuBar()->addMenu(tr("&Memory Controler"));
42 42 this->closeAction = this->menu->addAction(tr("Close plugin"));
43 43 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
44 44 return 1;
45 45 }
46 46
47 47 unsigned int memctrlrplugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
48 48 {
49 49 if(parent)
50 50 return parent->Write(Value,count,address);
51 51 return 0;
52 52 }
53 53
54 54 unsigned int memctrlrplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
55 55 {
56 56 if(parent)
57 57 return parent->Read(Value,count,address);
58 58 return 0;
59 59 }
60 60
61 61
62 62 bool memctrlrplugin::launchTest(unsigned int baseAddress,unsigned int size)
63 63 {
64 64 if(parent==NULL)return false;
65 65 unsigned int* dataLocal = (unsigned int*)malloc(size);
66 66 unsigned int* dataOnBoard = (unsigned int*)malloc(size);
67 67 bool res=true;
68 68 for(int i=0;(unsigned int)i<(size>>2);i++)
69 69 {
70 70 dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
71 71 }
72 72 parent->Write(dataLocal,size>>2,baseAddress);
73 73 parent->Read(dataOnBoard,size>>2,baseAddress);
74 74 for(int i=0;(unsigned int)i<(size>>2);i++)
75 75 {
76 76 if(dataLocal[i]!=dataOnBoard[i])
77 77 res=false;
78 78 }
79 79
80 80 free(dataLocal);
81 81 free(dataOnBoard);
82 82 return res;
83 83 }
84 84
85 85
86 86
@@ -1,50 +1,50
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 #define MEMCTRLRPLUGIN_H
24 24 #include "memctrlrpluginui.h"
25 25 #include <QMenuBar>
26 26 #include <QMenu>
27 27 #include <QAction>
28 28 #include <QMainWindow>
29 29
30 30
31 31 #include <socexplorerplugin.h>
32 32
33 33 class memctrlrplugin : public socexplorerplugin
34 34 {
35 35 Q_OBJECT
36 36 public:
37 37 explicit memctrlrplugin(QWidget *parent = 0);
38 38 ~memctrlrplugin();
39 39 int registermenu(QMainWindow *menuHolder);
40 40 public slots:
41 41 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
42 42 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
43 43 bool launchTest(unsigned int baseAddress,unsigned int size);
44 44 signals:
45 45
46 46 private:
47 47 memctrlrPluginUi* UI;
48 48 };
49 49
50 50 #endif // MEMCTRLRPLUGIN_H
@@ -1,36 +1,36
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 "memctrlrpluginui.h"
23 23
24 24 memctrlrPluginUi::memctrlrPluginUi(QWidget *parent) :
25 25 QWidget(parent)
26 26 {
27 27 this->mainlayout = new QHBoxLayout;
28 28 this->memorycheckWdgt = new memorycheck;
29 29 this->tabWdgt = new QTabWidget;
30 30 this->tabWdgt->addTab(this->memorycheckWdgt,QString(tr("Memory Check")));
31 31 this->mainlayout->addWidget(this->tabWdgt);
32 32 this->setLayout(this->mainlayout);
33 33 connect(this->memorycheckWdgt,SIGNAL(ReadSig(uint*,uint,uint)),this,SIGNAL(ReadSig(uint*,uint,uint)));
34 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 LPPMON Software
2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - 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 MEMCTRLRPLUGINUI_H
23 23 #define MEMCTRLRPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QHBoxLayout>
27 27 #include <QPushButton>
28 28 #include <QTabWidget>
29 29 #include "memorycheck.h"
30 30
31 31
32 32 class memctrlrPluginUi : public QWidget
33 33 {
34 34 Q_OBJECT
35 35 public:
36 36 explicit memctrlrPluginUi(QWidget *parent = 0);
37 37
38 38 signals:
39 39 unsigned int WriteSig(unsigned int* Value,unsigned int count,unsigned int address);
40 40 unsigned int ReadSig(unsigned int* Value,unsigned int count,unsigned int address);
41 41
42 42 private:
43 43 QHBoxLayout* mainlayout;
44 44 QTabWidget* tabWdgt;
45 45 memorycheck* memorycheckWdgt;
46 46
47 47 };
48 48
49 49 #endif
General Comments 0
You need to be logged in to leave comments. Login now