##// END OF EJS Templates
Removed deprecated genericPySysdriver interface.
jeandet -
r52:c8f8e77e323c default
parent child
Show More
@@ -1,177 +1,177
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "APBUARTPLUGIN.h"
22 #include "APBUARTPLUGIN.h"
23 #include <socexplorerengine.h>
23 #include <socexplorerengine.h>
24 #include <apbuartpywrapper.h>
24 #include <apbuartpywrapper.h>
25
25
26 ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent,false)
26 ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent,false)
27 {
27 {
28 this->setBaseAddress(-1);
28 this->setBaseAddress(-1);
29 this->p_curentAPBUart = 0;
29 this->p_curentAPBUart = 0;
30 this->UI = new APBUART_Plugin_ui();
30 this->UI = new APBUART_Plugin_ui();
31 this->setWidget((QWidget*)this->UI);
31 this->setWidget((QWidget*)this->UI);
32 this->uartConnected = false;
32 this->uartConnected = false;
33 this->UartThread = new UARTPollingThread(this);
33 this->UartThread = new UARTPollingThread(this);
34 this->pyObject = new APBUartPyWrapper(this);
34 // this->pyObject = new APBUartPyWrapper(this);
35 connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(fifoDebugChangeState(int)));
35 connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(fifoDebugChangeState(int)));
36 connect(this->UartThread,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString)));
36 connect(this->UartThread,SIGNAL(apbUartTextReceived(QString)),this->UI,SIGNAL(apbUartTextReceived(QString)));
37 connect(this->UI,SIGNAL(connectPort()),this,SLOT(toggleUartState()));
37 connect(this->UI,SIGNAL(connectPort()),this,SLOT(toggleUartState()));
38 connect(this->UI,SIGNAL(sendChar(char)),this->UartThread,SLOT(sendChar(char)));
38 connect(this->UI,SIGNAL(sendChar(char)),this->UartThread,SLOT(sendChar(char)));
39 connect(this->UI,SIGNAL(PortNameChanged(QString)),this->UartThread,SLOT(setPortName(QString)));
39 connect(this->UI,SIGNAL(PortNameChanged(QString)),this->UartThread,SLOT(setPortName(QString)));
40 connect(this->UI,SIGNAL(UartSpeedChanged(QString)),this->UartThread,SLOT(setPortSpeedStr(QString)));
40 connect(this->UI,SIGNAL(UartSpeedChanged(QString)),this->UartThread,SLOT(setPortSpeedStr(QString)));
41 connect(this->UI,SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList()));
41 connect(this->UI,SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList()));
42 connect(this->UI,SIGNAL(curentAPBUartChanged(int)),this,SLOT(setCurentAPBUart(int)));
42 connect(this->UI,SIGNAL(curentAPBUartChanged(int)),this,SLOT(setCurentAPBUart(int)));
43 connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(openUart()),this,SLOT(openUart()));
43 // connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(openUart()),this,SLOT(openUart()));
44 connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(closeUart()),this,SLOT(closeUart()));
44 // connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(closeUart()),this,SLOT(closeUart()));
45 connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setFifoDebugEnabled(bool)),this,SLOT(setFifoDebugEnabled(bool)));
45 // connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setFifoDebugEnabled(bool)),this,SLOT(setFifoDebugEnabled(bool)));
46 connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortNane(QString)),this,SLOT(setUARTPortNane(QString)));
46 // connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortNane(QString)),this,SLOT(setUARTPortNane(QString)));
47 connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortSpeed(int)),this,SLOT(setUARTPortSpeed(int)));
47 // connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(setUARTPortSpeed(int)),this,SLOT(setUARTPortSpeed(int)));
48 connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList()));
48 // connect(((APBUartPyWrapper*)this->pyObject),SIGNAL(updateAPBUartsList()),this,SLOT(updateAPBUartsList()));
49 this->UartThread->start();
49 this->UartThread->start();
50 }
50 }
51
51
52
52
53 ApbUartPlugin::~ApbUartPlugin()
53 ApbUartPlugin::~ApbUartPlugin()
54 {
54 {
55
55
56 }
56 }
57
57
58 int ApbUartPlugin::curentAPBUart()
58 int ApbUartPlugin::curentAPBUart()
59 {
59 {
60 return p_curentAPBUart;
60 return p_curentAPBUart;
61 }
61 }
62
62
63 void ApbUartPlugin::closeMe()
63 void ApbUartPlugin::closeMe()
64 {
64 {
65 emit this->closePlugin(this);
65 emit this->closePlugin(this);
66 }
66 }
67
67
68 void ApbUartPlugin::toggleUartState()
68 void ApbUartPlugin::toggleUartState()
69 {
69 {
70 if(!uartConnected)
70 if(!uartConnected)
71 {
71 {
72 this->openUart();
72 this->openUart();
73 }
73 }
74 else
74 else
75 {
75 {
76 this->closeUart();
76 this->closeUart();
77 }
77 }
78 }
78 }
79
79
80 void ApbUartPlugin::activate(bool flag)
80 void ApbUartPlugin::activate(bool flag)
81 {
81 {
82 socexplorerplugin::activate(flag);
82 socexplorerplugin::activate(flag);
83 this->updateAPBUartsList();
83 this->updateAPBUartsList();
84 }
84 }
85
85
86 void ApbUartPlugin::updateAPBUartsList()
86 void ApbUartPlugin::updateAPBUartsList()
87 {
87 {
88 QList<unsigned int> addresses;
88 QList<unsigned int> addresses;
89 int count = SocExplorerEngine::self()->getEnumDeviceCount(this,this->VID(),this->PID());
89 int count = SocExplorerEngine::self()->getEnumDeviceCount(this,this->VID(),this->PID());
90 for(int i=0;i<count;i++)
90 for(int i=0;i<count;i++)
91 {
91 {
92 addresses.append(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),i));
92 addresses.append(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),i));
93 }
93 }
94 this->UI->updateAPBUartList(addresses);
94 this->UI->updateAPBUartList(addresses);
95 }
95 }
96
96
97 void ApbUartPlugin::setCurentAPBUart(int index)
97 void ApbUartPlugin::setCurentAPBUart(int index)
98 {
98 {
99 this->p_curentAPBUart = index;
99 this->p_curentAPBUart = index;
100 this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),index));
100 this->setBaseAddress(SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,this->VID(),this->PID(),index));
101 }
101 }
102
102
103 void ApbUartPlugin::openUart()
103 void ApbUartPlugin::openUart()
104 {
104 {
105 if(this->UartThread->fifoDebugEnabled())
105 if(this->UartThread->fifoDebugEnabled())
106 setFifoDebugEnabled(false);
106 setFifoDebugEnabled(false);
107 if(!uartConnected)
107 if(!uartConnected)
108 uartConnected = this->UartThread->openUart();
108 uartConnected = this->UartThread->openUart();
109 this->UI->setUartConnected(uartConnected);
109 this->UI->setUartConnected(uartConnected);
110 }
110 }
111
111
112 void ApbUartPlugin::closeUart()
112 void ApbUartPlugin::closeUart()
113 {
113 {
114 if(uartConnected)
114 if(uartConnected)
115 this->UartThread->closeUart();
115 this->UartThread->closeUart();
116 this->uartConnected = false;
116 this->uartConnected = false;
117 this->UI->setUartConnected(uartConnected);
117 this->UI->setUartConnected(uartConnected);
118 }
118 }
119
119
120 void ApbUartPlugin::setFifoDebugEnabled(bool enable)
120 void ApbUartPlugin::setFifoDebugEnabled(bool enable)
121 {
121 {
122 if(uartConnected)
122 if(uartConnected)
123 closeUart();
123 closeUart();
124 this->UI->setEnableForLoopBack(!enable);
124 this->UI->setEnableForLoopBack(!enable);
125 this->UartThread->setFifoDebugEable(enable);
125 this->UartThread->setFifoDebugEable(enable);
126 }
126 }
127
127
128 void ApbUartPlugin::setAPBUartIndex(int index)
128 void ApbUartPlugin::setAPBUartIndex(int index)
129 {
129 {
130 this->UI->setAPBUartIndex(index);
130 this->UI->setAPBUartIndex(index);
131 }
131 }
132
132
133 void ApbUartPlugin::setUARTPortNane(QString name)
133 void ApbUartPlugin::setUARTPortNane(QString name)
134 {
134 {
135 this->UI->setUartPortName(name);
135 this->UI->setUartPortName(name);
136 }
136 }
137
137
138 void ApbUartPlugin::setUARTPortSpeed(int speed)
138 void ApbUartPlugin::setUARTPortSpeed(int speed)
139 {
139 {
140 this->UI->setUartSpeed(speed);
140 this->UI->setUartSpeed(speed);
141 }
141 }
142
142
143 void ApbUartPlugin::fifoDebugChangeState(int state)
143 void ApbUartPlugin::fifoDebugChangeState(int state)
144 {
144 {
145 if(state==Qt::Checked)
145 if(state==Qt::Checked)
146 {
146 {
147 this->setFifoDebugEnabled(true);
147 this->setFifoDebugEnabled(true);
148 }
148 }
149 else
149 else
150 {
150 {
151 this->setFifoDebugEnabled(false);
151 this->setFifoDebugEnabled(false);
152 }
152 }
153 }
153 }
154
154
155
155
156 unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
156 unsigned int ApbUartPlugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
157 {
157 {
158 if(parent!=NULL)
158 if(parent!=NULL)
159 return parent->Read(Value,count,address);
159 return parent->Read(Value,count,address);
160 return 0;
160 return 0;
161 }
161 }
162
162
163
163
164 unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
164 unsigned int ApbUartPlugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
165 {
165 {
166 if(parent!=NULL)
166 if(parent!=NULL)
167 return parent->Write(Value,count,address);
167 return parent->Write(Value,count,address);
168 return 0;
168 return 0;
169 }
169 }
170
170
171
171
172
172
173
173
174
174
175
175
176
176
177
177
@@ -1,508 +1,550
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include <socexplorerengine.h>
22 #include <socexplorerengine.h>
23 #include "ahbuartplugin.h"
23 #include "ahbuartplugin.h"
24 #include <unistd.h>
24 #include <unistd.h>
25 #include <errno.h>
25 #include <errno.h>
26 #include <QApplication>
26 #include <QApplication>
27 #include <QProgressBar>
27 #include <QProgressBar>
28 #include <stdio.h>
28 #include <stdio.h>
29 #include <QThread>
29 #include <QThread>
30 #include "ahbuartpywrapper.h"
30 #include "ahbuartpywrapper.h"
31 #include <QCompleter>
31 #include <QCompleter>
32 #include <QStringList>
32 #include <QStringList>
33 #include <QLineEdit>
33 #include <QLineEdit>
34 #include <socexplorerproxy.h>
34 #include <socexplorerproxy.h>
35
35
36 ahbuartplugin::ahbuartplugin(QWidget *parent):socexplorerplugin(parent,false)
36 ahbuartplugin::ahbuartplugin(QWidget *parent):socexplorerplugin(parent,false)
37 {
37 {
38 this->port =(rs232port_t)NULL;
38 this->port =(rs232port_t)NULL;
39 this->portMutex = new QMutex(QMutex::Recursive);
39 this->portMutex = new QMutex(QMutex::Recursive);
40 this->UI = new ahbUartPluginUI();
40 this->UI = new ahbUartPluginUI();
41 this->setWidget((QWidget*)this->UI);
41 this->setWidget((QWidget*)this->UI);
42 QObject::connect(this,SIGNAL(activateSig(bool)),this->UI,SLOT(setConnected(bool)));
42 QObject::connect(this,SIGNAL(activateSig(bool)),this->UI,SLOT(setConnected(bool)));
43 QObject::connect(this->UI,SIGNAL(connectPortsig(QString,int)),this,SLOT(togglePort(QString,int)));
43 QObject::connect(this->UI,SIGNAL(connectPortsig(QString,int)),this,SLOT(togglePort(QString,int)));
44 this->pyObject = new ahbuartPywrapper(this);
44 // this->pyObject = new ahbuartPywrapper(this);
45 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(open(QString,int)),this,SLOT(open(QString,int)));
45 // QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(open(QString,int)),this,SLOT(open(QString,int)));
46 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(close()),this,SLOT(close()));
46 // QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(close()),this,SLOT(close()));
47 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(ReadBytes(uint,uint)),this,SLOT(ReadBytes(uint,uint)));
47 // QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(ReadBytes(uint,uint)),this,SLOT(ReadBytes(uint,uint)));
48 QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(WriteBytes(uint,QList<QVariant>)),this,SLOT(WriteBytes(uint,QList<QVariant>)));
48 // QObject::connect(((ahbuartPywrapper*)this->pyObject),SIGNAL(WriteBytes(uint,QList<QVariant>)),this,SLOT(WriteBytes(uint,QList<QVariant>)));
49 QObject::connect(this->UI,SIGNAL(rescanPorts()),this,SLOT(updatePortList()));
49 QObject::connect(this->UI,SIGNAL(rescanPorts()),this,SLOT(updatePortList()));
50 QObject::connect(this,SIGNAL(addReadBytes(int)),this->UI,SLOT(addReadBytes(int)));
50 QObject::connect(this,SIGNAL(addReadBytes(int)),this->UI,SLOT(addReadBytes(int)));
51 QObject::connect(this,SIGNAL(addWritenBytes(int)),this->UI,SLOT(addWritenBytes(int)));
51 QObject::connect(this,SIGNAL(addWritenBytes(int)),this->UI,SLOT(addWritenBytes(int)));
52 this->portListcompleter = NULL;
52 this->portListcompleter = NULL;
53 this->scanDone = false;
53 this->scanDone = false;
54 updatePortList();
54 updatePortList();
55 }
55 }
56
56
57
57
58 ahbuartplugin::~ahbuartplugin()
58 ahbuartplugin::~ahbuartplugin()
59 {
59 {
60 if(this->port!=(rs232port_t)NULL)
60 if(this->port!=(rs232port_t)NULL)
61 {
61 {
62 rs232close(this->port);
62 rs232close(this->port);
63 this->port = (rs232port_t)NULL;
63 this->port = (rs232port_t)NULL;
64 }
64 }
65 this->UI->close();
65 this->UI->close();
66 this->UI->~ahbUartPluginUI();
66 this->UI->~ahbUartPluginUI();
67 }
67 }
68
68
69
69
70 void ahbuartplugin::closeMe()
70 void ahbuartplugin::closeMe()
71 {
71 {
72 if(this->port!=(rs232port_t)NULL)
72 if(this->port!=(rs232port_t)NULL)
73 {
73 {
74 rs232close(this->port);
74 rs232close(this->port);
75 this->port = (rs232port_t)NULL;
75 this->port = (rs232port_t)NULL;
76 }
76 }
77 emit this->closePlugin(this);
77 emit this->closePlugin(this);
78 }
78 }
79
79
80 int ahbuartplugin::registermenu(QMainWindow *menuHolder)
80 int ahbuartplugin::registermenu(QMainWindow *menuHolder)
81 {
81 {
82 this->menu = menuHolder->menuBar()->addMenu(tr("&AHB UART"));
82 this->menu = menuHolder->menuBar()->addMenu(tr("&AHB UART"));
83 this->closeAction = this->menu->addAction(tr("Close plugin"));
83 this->closeAction = this->menu->addAction(tr("Close plugin"));
84 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
84 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
85 return 1;
85 return 1;
86 }
86 }
87
87
88
88
89 bool ahbuartplugin::checkConnection()
89 bool ahbuartplugin::checkConnection()
90 {
90 {
91 QTime timeout;
91 QTime timeout;
92 char test[5] ={(char)0x80,(char)0x80,(char)0,(char)0,(char)0};
92 char test[5] ={(char)0x80,(char)0x80,(char)0,(char)0,(char)0};
93 char test2[1024];
93 char test2[1024];
94 int writen =0;
94 int writen =0;
95 int read = 0;
95 int read = 0;
96 timeout.start();
96 timeout.start();
97 SocExplorerEngine::message(this,"Check connection",2);
97 SocExplorerEngine::message(this,"Check connection",2);
98 QMutexLocker lock(portMutex);
98 QMutexLocker lock(portMutex);
99 while(writen!=5)
99 while(writen!=5)
100 {
100 {
101 writen+=rs232write(this->port,test+writen,5-writen);
101 writen+=rs232write(this->port,test+writen,5-writen);
102 if(timeout.elapsed()>1000)
102 if(timeout.elapsed()>1000)
103 {
103 {
104 SocExplorerEngine::message(this,"Can't write any data on serial port",2);
104 SocExplorerEngine::message(this,"Can't write any data on serial port",2);
105 return false;
105 return false;
106 }
106 }
107 }
107 }
108 #ifdef WIN32
108 #ifdef WIN32
109 usleep(1000);
109 usleep(1000);
110 #endif
110 #endif
111 timeout.restart();
111 timeout.restart();
112 int avail = 0;
112 int avail = 0;
113 do
113 do
114 {
114 {
115 avail = rs232availablebytes(this->port);
115 avail = rs232availablebytes(this->port);
116 if(timeout.elapsed()>1000)
116 if(timeout.elapsed()>1000)
117 {
117 {
118 if(avail)
118 if(avail)
119 rs232read(this->port,test2,avail);
119 rs232read(this->port,test2,avail);
120 SocExplorerEngine::message(this,"Connection Error",2);
120 SocExplorerEngine::message(this,"Connection Error",2);
121 return false;
121 return false;
122 }
122 }
123 }while(avail<4);
123 }while(avail<4);
124 read = rs232read(this->port,test2,avail);
124 read = rs232read(this->port,test2,avail);
125 if(read>0)
125 if(read>0)
126 {
126 {
127 SocExplorerEngine::message(this,"Connection Ok",2);
127 SocExplorerEngine::message(this,"Connection Ok",2);
128 return true;
128 return true;
129 }
129 }
130 else
130 else
131 {
131 {
132 SocExplorerEngine::message(this,"Connection Error",2);
132 SocExplorerEngine::message(this,"Connection Error",2);
133 return false;
133 return false;
134 }
134 }
135 }
135 }
136
136
137 void ahbuartplugin::connectPort(QString PortName, int baudrate)
137 void ahbuartplugin::connectPort(QString PortName, int baudrate)
138 {
138 {
139 QTime timeout;
139 QTime timeout;
140 SocExplorerEngine::message(this,"Try to connect to port "+PortName,2);
140 SocExplorerEngine::message(this,"Try to connect to port "+PortName,2);
141 timeout.start();
141 timeout.start();
142 QMutexLocker lock(portMutex);
142 QMutexLocker lock(portMutex);
143 if(this->port==(rs232port_t)NULL)
143 if(this->port==(rs232port_t)NULL)
144 {
144 {
145 SocExplorerEngine::message(this,"Open port "+PortName,2);
145 SocExplorerEngine::message(this,"Open port "+PortName,2);
146 this->port=rs232open((char*)PortName.toStdString().c_str());
146 this->port=rs232open((char*)PortName.toStdString().c_str());
147 }
147 }
148 if(this->port!=badPortValue)
148 if(this->port!=badPortValue)
149 {
149 {
150 SocExplorerEngine::message(this,"Port opened "+PortName,2);
150 SocExplorerEngine::message(this,"Port opened "+PortName,2);
151 SocExplorerEngine::message(this,"Configure port "+PortName,2);
151 SocExplorerEngine::message(this,"Configure port "+PortName,2);
152 rs232setup(this->port,8,baudrate,rs232parityNo,rs232OneStop);
152 rs232setup(this->port,8,baudrate,rs232parityNo,rs232OneStop);
153 char test[7] ={(char)0x55,(char)0x51,(char)0x80,(char)0x80,(char)0x0,(char)0x0,(char)0x14};
153 char test[7] ={(char)0x55,(char)0x51,(char)0x80,(char)0x80,(char)0x0,(char)0x0,(char)0x14};
154 char test2[1024];
154 char test2[1024];
155 SAFEWRITE(test,1,timeout,2000,return);
155 SAFEWRITE(test,1,timeout,2000,return);
156 SAFEWRITE((test+1),1,timeout,2000,return);
156 SAFEWRITE((test+1),1,timeout,2000,return);
157 rs232read(this->port,test2,512);
157 rs232read(this->port,test2,512);
158 int read = 0;
158 int read = 0;
159 for(int i=0;i<10;i++)
159 for(int i=0;i<10;i++)
160 {
160 {
161 SocExplorerEngine::message(this,"Send test patern :0x55,0x55,0x80,0x80,0x0,0x0,0x14",2);
161 SocExplorerEngine::message(this,"Send test patern :0x55,0x55,0x80,0x80,0x0,0x0,0x14",2);
162 SAFEWRITE(test+2,5,timeout,2000,return);
162 SAFEWRITE(test+2,5,timeout,2000,return);
163 SocExplorerEngine::message(this,"Read Result",2);
163 SocExplorerEngine::message(this,"Read Result",2);
164 read=rs232read(this->port,test2+read,16);
164 read=rs232read(this->port,test2+read,16);
165 SocExplorerEngine::message(this,QString("Get ") + QString::number(read) + " bytes",2);
165 SocExplorerEngine::message(this,QString("Get ") + QString::number(read) + " bytes",2);
166 if(read>0)
166 if(read>0)
167 {
167 {
168 SocExplorerEngine::message(this,"Flush port ",2);
168 SocExplorerEngine::message(this,"Flush port ",2);
169 while(rs232read(this->port,test2,1)>0);
169 while(rs232read(this->port,test2,1)>0);
170 this->Connected = true;
170 this->Connected = true;
171 SocExplorerEngine::message(this,QString("Connection success on ")+PortName,2);
171 SocExplorerEngine::message(this,QString("Connection success on ")+PortName,2);
172 emit this->activate(true);
172 emit this->activate(true);
173 if(this->scanDone==false)
173 if(this->scanDone==false)
174 {
174 {
175 socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN");
175 socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN");
176 this->scanDone=true;
176 this->scanDone=true;
177 }
177 }
178 this->UI->setSystemSpeed(this->detectSpeed());
178 break;
179 break;
179 }
180 }
180 }
181 }
181 }
182 }
182 else
183 else
183 {
184 {
184 SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2);
185 SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2);
185 this->port = (rs232port_t)NULL;
186 this->port = (rs232port_t)NULL;
186 this->Connected = false;
187 this->Connected = false;
187 emit this->activateSig(false);
188 emit this->activateSig(false);
188 return;
189 return;
189 }
190 }
190 if(this->Connected == false)
191 if(this->Connected == false)
191 {
192 {
192 SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2);
193 SocExplorerEngine::message(this,QString("Port not opened ")+PortName,2);
193 rs232close(this->port);
194 rs232close(this->port);
194 this->port = (rs232port_t)NULL;
195 this->port = (rs232port_t)NULL;
195 emit this->activateSig(false);
196 emit this->activateSig(false);
196 }
197 }
197
198
198 }
199 }
199
200
200 bool ahbuartplugin::open(QString PortName,int baudrate)
201 bool ahbuartplugin::open(QString PortName,int baudrate)
201 {
202 {
202 if(this->port!=(rs232port_t)NULL)
203 if(this->port!=(rs232port_t)NULL)
203 this->close();
204 this->close();
204 this->UI->setconfig(PortName,baudrate);
205 this->UI->setconfig(PortName,baudrate);
205 this->connectPort(PortName,baudrate);
206 this->connectPort(PortName,baudrate);
206 return (this->port!=(rs232port_t)NULL);
207 return (this->port!=(rs232port_t)NULL);
207 }
208 }
208
209
209 void ahbuartplugin::close()
210 void ahbuartplugin::close()
210 {
211 {
211 if(this->port!=(rs232port_t)NULL)
212 if(this->port!=(rs232port_t)NULL)
212 {
213 {
213 rs232close(this->port);
214 rs232close(this->port);
214 this->port = (rs232port_t)NULL;
215 this->port = (rs232port_t)NULL;
215 this->Connected = false;
216 this->Connected = false;
216 emit this->activateSig(false);
217 emit this->activateSig(false);
217 }
218 }
218 }
219 }
219
220
220 void ahbuartplugin::togglePort(QString PortName,int baudrate)
221 void ahbuartplugin::togglePort(QString PortName,int baudrate)
221 {
222 {
222 if(this->port!=(rs232port_t)NULL)
223 if(this->port!=(rs232port_t)NULL)
223 {
224 {
224 this->close();
225 this->close();
225 }
226 }
226 else
227 else
227 {
228 {
228 this->connectPort(PortName,baudrate);
229 this->connectPort(PortName,baudrate);
229 }
230 }
230 }
231 }
231
232
232
233
233 unsigned int ahbuartplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
234 unsigned int ahbuartplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
234 {
235 {
235 QTime timeout;
236 QTime timeout;
236 timeout.start();
237 timeout.start();
237 unsigned int read=0;
238 unsigned int read=0;
238 unsigned int cnt=count;
239 unsigned int cnt=count;
239 unsigned int nextUpdateTrig=0,updateStep=1024;
240 unsigned int nextUpdateTrig=0,updateStep=1024;
240 SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
241 SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
241 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
242 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
242 {
243 {
243 QMutexLocker lock(portMutex);
244 QMutexLocker lock(portMutex);
244 if(!this->checkConnection())
245 if(!this->checkConnection())
245 {
246 {
246 this->Connected = false;
247 this->Connected = false;
247 emit this->activateSig(false);
248 emit this->activateSig(false);
248 this->portMutex->unlock();
249 this->portMutex->unlock();
249 return 0;
250 return 0;
250 }
251 }
251 QProgressBar* progress=NULL;
252 QProgressBar* progress=NULL;
252 if(cnt>128)
253 if(cnt>128)
253 progress= SocExplorerEngine::getProgressBar("Reading on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
254 progress= SocExplorerEngine::getProgressBar("Reading on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
254 char CMD[5];
255 char CMD[5];
255 char* result = (char*)malloc(count*4);
256 char* result = (char*)malloc(count*4);
256 while(count>32)
257 while(count>32)
257 {
258 {
258 CMD[0] = 0x80 | (32-1);
259 CMD[0] = 0x80 | (32-1);
259 CMD[1] = (char)((address>>24)&0xFF);
260 CMD[1] = (char)((address>>24)&0xFF);
260 CMD[2] = (char)((address>>16)&0xFF);
261 CMD[2] = (char)((address>>16)&0xFF);
261 CMD[3] = (char)((address>>8)&0xFF);
262 CMD[3] = (char)((address>>8)&0xFF);
262 CMD[4] = (char)((address)&0xFF);
263 CMD[4] = (char)((address)&0xFF);
263 SAFEWRITE(CMD,5,timeout,1000,return 0);
264 SAFEWRITE(CMD,5,timeout,1000,return 0);
264 timeout.restart();
265 timeout.restart();
265 int avail=0;
266 int avail=0;
266 do{
267 do{
267 avail=rs232availablebytes(this->port);
268 avail=rs232availablebytes(this->port);
268 if(timeout.elapsed()>1000)
269 if(timeout.elapsed()>1000)
269 {
270 {
270 rs232close(this->port);
271 rs232close(this->port);
271 this->port = (rs232port_t)NULL;
272 this->port = (rs232port_t)NULL;
272 this->Connected = false;
273 this->Connected = false;
273 emit this->activateSig(false);
274 emit this->activateSig(false);
274 return 0;
275 return 0;
275 }
276 }
276 }while(avail<(32*4));
277 }while(avail<(32*4));
277 rs232read(this->port,result+((cnt-count)*4),32*4);
278 rs232read(this->port,result+((cnt-count)*4),32*4);
278 count-=32;
279 count-=32;
279 address+=32*4;
280 address+=32*4;
280 if(cnt>128)
281 if(cnt>128)
281 {
282 {
282
283
283 if((cnt-count)>=nextUpdateTrig)
284 if((cnt-count)>=nextUpdateTrig)
284 {
285 {
285 progress->setValue(cnt-count);
286 progress->setValue(cnt-count);
286 qApp->processEvents();
287 qApp->processEvents();
287 nextUpdateTrig+=updateStep;
288 nextUpdateTrig+=updateStep;
288 }
289 }
289 }
290 }
290 }
291 }
291 if(count>0)
292 if(count>0)
292 {
293 {
293 CMD[0] = 0x80 | (count-1);
294 CMD[0] = 0x80 | (count-1);
294 CMD[1] = (char)((address>>24)&0xFF);
295 CMD[1] = (char)((address>>24)&0xFF);
295 CMD[2] = (char)((address>>16)&0xFF);
296 CMD[2] = (char)((address>>16)&0xFF);
296 CMD[3] = (char)((address>>8)&0xFF);
297 CMD[3] = (char)((address>>8)&0xFF);
297 CMD[4] = (char)((address)&0xFF);
298 CMD[4] = (char)((address)&0xFF);
298 SAFEWRITE(CMD,5,timeout,1000,return 0);
299 SAFEWRITE(CMD,5,timeout,1000,return 0);
299 timeout.restart();
300 timeout.restart();
300 int avail=0;
301 int avail=0;
301 do{
302 do{
302 avail=rs232availablebytes(this->port);
303 avail=rs232availablebytes(this->port);
303 if(timeout.elapsed()>1000)
304 if(timeout.elapsed()>1000)
304 {
305 {
305 rs232close(this->port);
306 rs232close(this->port);
306 this->port = (rs232port_t)NULL;
307 this->port = (rs232port_t)NULL;
307 this->Connected = false;
308 this->Connected = false;
308 emit this->activateSig(false);
309 emit this->activateSig(false);
309 return 0;
310 return 0;
310 }
311 }
311 }while(avail<(count*4));
312 }while(avail<(count*4));
312 rs232read(this->port,result+((cnt-count)*4),count*4);
313 rs232read(this->port,result+((cnt-count)*4),count*4);
313 }
314 }
314 if(cnt>128)
315 if(cnt>128)
315 {
316 {
316 progress->setValue(cnt-count);
317 progress->setValue(cnt-count);
317 qApp->processEvents();
318 qApp->processEvents();
318 }
319 }
319 for(int i=0;(unsigned int)i<cnt;i++)
320 for(int i=0;(unsigned int)i<cnt;i++)
320 {
321 {
321 #if __BYTE_ORDER == __LITTLE_ENDIAN
322 #if __BYTE_ORDER == __LITTLE_ENDIAN
322 // for(int j =0;j<4;j++)
323 // for(int j =0;j<4;j++)
323 // {
324 // {
324 // Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256;
325 // Value[i]= ((unsigned char)(result[i*4+j])) + Value[i]*256;
325 // }
326 // }
326 Value[i]= socexplorerBswap32(((uint32_t*)result)[i]);
327 Value[i]= socexplorerBswap32(((uint32_t*)result)[i]);
327 #elif __BYTE_ORDER == __BIG_ENDIAN
328 #elif __BYTE_ORDER == __BIG_ENDIAN
328 Value[i]= ((uint32_t*)result)[i];
329 Value[i]= ((uint32_t*)result)[i];
329 #endif
330 #endif
330 }
331 }
331 read = cnt*4;
332 read = cnt*4;
332 if(cnt>128)
333 if(cnt>128)
333 SocExplorerEngine::deleteProgressBar(progress);
334 SocExplorerEngine::deleteProgressBar(progress);
334 free(result);
335 free(result);
335 }
336 }
336 emit this->addReadBytes(read);
337 emit this->addReadBytes(read);
337 return read/4;
338 return read/4;
338 }
339 }
339
340
340 unsigned int ahbuartplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
341 unsigned int ahbuartplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
341 {
342 {
342 QTime timeout;
343 QTime timeout;
343 timeout.start();
344 timeout.start();
344 unsigned int writen=0;
345 unsigned int writen=0;
345 unsigned int nextUpdateTrig=0,updateStep=1024;
346 unsigned int nextUpdateTrig=0,updateStep=1024;
346 SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
347 SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
347 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
348 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
348 {
349 {
349 QMutexLocker lock(portMutex);
350 QMutexLocker lock(portMutex);
350 if(!this->checkConnection())
351 if(!this->checkConnection())
351 {
352 {
352 emit this->activateSig(false);
353 emit this->activateSig(false);
353 this->Connected = false;
354 this->Connected = false;
354 this->portMutex->unlock();
355 this->portMutex->unlock();
355 return 0;
356 return 0;
356 }
357 }
357 QProgressBar* progress = NULL;
358 QProgressBar* progress = NULL;
358 if(count>128)
359 if(count>128)
359 progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
360 progress = SocExplorerEngine::getProgressBar("Writing on uart @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count);
360 int offset = 0;
361 int offset = 0;
361 char* CMD= (char*)malloc((32*4)+5);
362 char* CMD= (char*)malloc((32*4)+5);
362 writen=0;
363 writen=0;
363 while(count>32)
364 while(count>32)
364 {
365 {
365 CMD[0] = 0xC0 | (32-1);
366 CMD[0] = 0xC0 | (32-1);
366 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
367 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
367 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
368 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
368 CMD[3] = (char)(((unsigned int)address>>8)&0xFF);
369 CMD[3] = (char)(((unsigned int)address>>8)&0xFF);
369 CMD[4] = (char)(((unsigned int)address)&0xFF);
370 CMD[4] = (char)(((unsigned int)address)&0xFF);
370 for(int i=0;i<32;i++)
371 for(int i=0;i<32;i++)
371 {
372 {
372 #if __BYTE_ORDER == __LITTLE_ENDIAN
373 #if __BYTE_ORDER == __LITTLE_ENDIAN
373 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
374 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
374 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
375 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
375 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
376 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
376 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF);
377 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF);
377 #elif __BYTE_ORDER == __BIG_ENDIAN
378 #elif __BYTE_ORDER == __BIG_ENDIAN
378 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset])&0xFF);
379 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset])&0xFF);
379 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
380 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
380 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
381 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
381 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
382 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
382 #endif
383 #endif
383 }
384 }
384 SAFEWRITE(CMD,((32*4)+5),timeout,1000,return 0);
385 SAFEWRITE(CMD,((32*4)+5),timeout,1000,return 0);
385 writen+=32;
386 writen+=32;
386 count-=32;
387 count-=32;
387 offset+=32;
388 offset+=32;
388 address+=32*4;
389 address+=32*4;
389 if(offset>=nextUpdateTrig && progress!=NULL)
390 if(offset>=nextUpdateTrig && progress!=NULL)
390 {
391 {
391 progress->setValue(offset);
392 progress->setValue(offset);
392 qApp->processEvents();
393 qApp->processEvents();
393 nextUpdateTrig +=updateStep;
394 nextUpdateTrig +=updateStep;
394 }
395 }
395
396
396 }
397 }
397 if(count>0)
398 if(count>0)
398 {
399 {
399 CMD[0] = 0xC0 | (count-1);
400 CMD[0] = 0xC0 | (count-1);
400 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
401 CMD[1] = (char)(((unsigned int)address>>24)&0xFF);
401 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
402 CMD[2] = (char)(((unsigned int)address>>16)&0xFF);
402 CMD[3] = (char)(((unsigned int)address>>8)&0xFF);
403 CMD[3] = (char)(((unsigned int)address>>8)&0xFF);
403 CMD[4] = (char)(((unsigned int)address)&0xFF);
404 CMD[4] = (char)(((unsigned int)address)&0xFF);
404 for(int i=0;(unsigned int) i<(count);i++)
405 for(int i=0;(unsigned int) i<(count);i++)
405 {
406 {
406 #if __BYTE_ORDER == __LITTLE_ENDIAN
407 #if __BYTE_ORDER == __LITTLE_ENDIAN
407 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
408 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
408 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
409 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
409 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
410 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
410 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF);
411 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset])&0xFF);
411 #elif __BYTE_ORDER == __BIG_ENDIAN
412 #elif __BYTE_ORDER == __BIG_ENDIAN
412 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset])&0xFF);
413 CMD[(i*4)+5] = (char)(((unsigned int)Value[i+offset])&0xFF);
413 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
414 CMD[(i*4)+6] = (char)(((unsigned int)Value[i+offset]>>8)&0xFF);
414 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
415 CMD[(i*4)+7] = (char)(((unsigned int)Value[i+offset]>>16)&0xFF);
415 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
416 CMD[(i*4)+8] = (char)(((unsigned int)Value[i+offset]>>24)&0xFF);
416 #endif
417 #endif
417 }
418 }
418 SAFEWRITE(CMD,((count*4)+5),timeout,1000,return 0);
419 SAFEWRITE(CMD,((count*4)+5),timeout,1000,return 0);
419 writen+=count;
420 writen+=count;
420 }
421 }
421 if(progress!=NULL)
422 if(progress!=NULL)
422 {
423 {
423 progress->setValue(writen);
424 progress->setValue(writen);
424 qApp->processEvents();
425 qApp->processEvents();
425 SocExplorerEngine::deleteProgressBar(progress);
426 SocExplorerEngine::deleteProgressBar(progress);
426 }
427 }
427 free(CMD);
428 free(CMD);
428 emit this->addWritenBytes(writen*4);
429 emit this->addWritenBytes(writen*4);
429 return writen;
430 return writen;
430 }
431 }
431 return 0;
432 return 0;
432 }
433 }
433
434
434
435
435
436
436
437
437 void ahbuartplugin::updatePortList()
438 void ahbuartplugin::updatePortList()
438 {
439 {
439 if(this->portListcompleter==(QCompleter*)NULL)
440 if(this->portListcompleter==(QCompleter*)NULL)
440 {
441 {
441 this->portListcompleter=new QCompleter(this);
442 this->portListcompleter=new QCompleter(this);
442 this->portListcompleter->setCaseSensitivity(Qt::CaseInsensitive);
443 this->portListcompleter->setCaseSensitivity(Qt::CaseInsensitive);
443 this->portListcompleterModel = new QStringListModel(this);
444 this->portListcompleterModel = new QStringListModel(this);
444 this->portListcompleter->setModel(this->portListcompleterModel);
445 this->portListcompleter->setModel(this->portListcompleterModel);
445 this->UI->setCompleter(this->portListcompleter);
446 this->UI->setCompleter(this->portListcompleter);
446 }
447 }
447 rs232portslist_t* portlist = rs232getportlist();
448 rs232portslist_t* portlist = rs232getportlist();
448 rs232portslist_t* portlistenum = portlist;
449 rs232portslist_t* portlistenum = portlist;
449 QStringList wordList;
450 QStringList wordList;
450 while(portlistenum!=NULL)
451 while(portlistenum!=NULL)
451 {
452 {
452 wordList << portlistenum->name;
453 wordList << portlistenum->name;
453 portlistenum = portlistenum->next;
454 portlistenum = portlistenum->next;
454 }
455 }
455 rs232deleteportlist(portlist);
456 rs232deleteportlist(portlist);
456 this->portListcompleterModel->setStringList(wordList);
457 this->portListcompleterModel->setStringList(wordList);
457 }
458 }
458
459
459 QVariantList ahbuartplugin::ReadBytes(unsigned int address, unsigned int count)
460 QVariantList ahbuartplugin::ReadBytes(unsigned int address, unsigned int count)
460 {
461 {
461 unsigned int data[(count/4)+1];
462 unsigned int data[(count/4)+1];
462 QVariantList result;
463 QVariantList result;
463 this->Read(data,(count/4)+1,address);
464 this->Read(data,(count/4)+1,address);
464 for(unsigned int i = 0;i<count/4;i++)
465 for(unsigned int i = 0;i<count/4;i++)
465 {
466 {
466 result.append(QVariant((int)(0x0FF&(data[i]>>24))));
467 result.append(QVariant((int)(0x0FF&(data[i]>>24))));
467 result.append(QVariant((int)(0x0FF&(data[i]>>16))));
468 result.append(QVariant((int)(0x0FF&(data[i]>>16))));
468 result.append(QVariant((int)(0x0FF&(data[i]>>8))));
469 result.append(QVariant((int)(0x0FF&(data[i]>>8))));
469 result.append(QVariant((int)(0x0FF&(data[i]))));
470 result.append(QVariant((int)(0x0FF&(data[i]))));
470 }
471 }
471
472
472 for(int i=0;i<(count%4);i++)
473 for(int i=0;i<(count%4);i++)
473 {
474 {
474 result.append(QVariant((int)(0x0FF&(data[count/4]>>((3-i)*8)))));
475 result.append(QVariant((int)(0x0FF&(data[count/4]>>((3-i)*8)))));
475 }
476 }
476
477
477 return result;
478 return result;
478 }
479 }
479
480
480 void ahbuartplugin::WriteBytes(unsigned int address, QList<QVariant> dataList)
481 void ahbuartplugin::WriteBytes(unsigned int address, QList<QVariant> dataList)
481 {
482 {
482 unsigned int data[dataList.count()/4];
483 unsigned int data[dataList.count()/4];
483 for(int i = 0;i<(dataList.count()/4);i++)
484 for(int i = 0;i<(dataList.count()/4);i++)
484 {
485 {
485 data[i] = 0x0FF & ((unsigned int)dataList.at(4*i).toUInt());
486 data[i] = 0x0FF & ((unsigned int)dataList.at(4*i).toUInt());
486 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+1).toUInt()));
487 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+1).toUInt()));
487 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+2).toUInt()));
488 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+2).toUInt()));
488 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+3).toUInt()));
489 data[i] = (data[i]<<8) + (0x0FF & ((unsigned int)dataList.at((4*i)+3).toUInt()));
489 }
490 }
490 this->Write(data,dataList.count()/4,address);
491 this->Write(data,dataList.count()/4,address);
491 }
492 }
492
493
494 int ahbuartplugin::detectSpeed()
495 {
496 //scaler = (((system_clk*10)/(baudrate*8))-5)/10
497 unsigned int ahbUartBaseAddress = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01,0x007,0);
498 // unsigned int dsuBaseAddress = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01,0x0017,0);
499 unsigned int dsuBaseAddress = 0x90000000;
500 unsigned int scaler = 0,dsuVal1=0,dsuVal2=0;
501 int speed=0;
502 QElapsedTimer time;
503 if(dsuBaseAddress!=-1)
504 {
505 time.start();
506 if( this->Read(&dsuVal1,1,dsuBaseAddress+0x08)==1)
507 {
508 usleep(1000*1000);
509 qint64 el = time.elapsed();
510 this->Read(&dsuVal2,1,dsuBaseAddress+0x08);
511 if(dsuVal1!=dsuVal2)
512 return ((dsuVal2-dsuVal1)/el)*1000;
513 }
514 }
515 if(ahbUartBaseAddress!=-1)
516 {
517 if( this->Read(&scaler,1,ahbUartBaseAddress+0x0C)==1)
518 {
519 scaler&=0x3FFFF;
520 speed = (int)(((double)scaler*10.0)+5.0)*((double)this->UI->baudRate()/10.0)*8.0;
521 // speed = (int)((double)(scaler+1)*8.0*(double)this->UI->baudRate());
522 }
523 }
524 return speed;
525 }
526
527 void ahbuartplugin::postInstantiationTrigger()
528 {
529 if(this->scanDone && this->Connected)
530 {
531 this->UI->setSystemSpeed(this->detectSpeed());
532 }
533 }
493
534
494
535
495
536
496
537
497
538
498
539
499
540
500
541
501
542
502
543
503
544
504
545
505
546
506
547
507
548
508
549
550
@@ -1,99 +1,101
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef AHBUARTPLUGIN_H
22 #ifndef AHBUARTPLUGIN_H
23 #define AHBUARTPLUGIN_H
23 #define AHBUARTPLUGIN_H
24 #include <QMenuBar>
24 #include <QMenuBar>
25 #include <QMenu>
25 #include <QMenu>
26 #include <QAction>
26 #include <QAction>
27 #include <QLayout>
27 #include <QLayout>
28 #include <QMutex>
28 #include <QMutex>
29 #include <QProgressDialog>
29 #include <QProgressDialog>
30 #include <QStringListModel>
30 #include <QStringListModel>
31 #include <QTime>
31 #include <QTime>
32 #include <socexplorerplugin.h>
32 #include <socexplorerplugin.h>
33 #include "ahbuartpluginui.h"
33 #include "ahbuartpluginui.h"
34 #include <RS232.h>
34 #include <RS232.h>
35 #include <unistd.h>
35 #include <unistd.h>
36
36
37
37
38 #define SAFEWRITE(data,count,timer,timeout,error) \
38 #define SAFEWRITE(data,count,timer,timeout,error) \
39 while(1)\
39 while(1)\
40 {\
40 {\
41 unsigned int __writen__=0; \
41 unsigned int __writen__=0; \
42 (timer).restart(); \
42 (timer).restart(); \
43 while(__writen__!=(count)) \
43 while(__writen__!=(count)) \
44 {\
44 {\
45 __writen__ += rs232write(this->port,((data)+__writen__),((count)-__writen__)); \
45 __writen__ += rs232write(this->port,((data)+__writen__),((count)-__writen__)); \
46 if((timer).elapsed()>(timeout)) \
46 if((timer).elapsed()>(timeout)) \
47 {\
47 {\
48 this->port = (rs232port_t)NULL; \
48 this->port = (rs232port_t)NULL; \
49 this->Connected = false; \
49 this->Connected = false; \
50 emit this->activateSig(false); \
50 emit this->activateSig(false); \
51 error; \
51 error; \
52 } \
52 } \
53 } \
53 } \
54 break;\
54 break;\
55 }
55 }
56
56
57
57
58
58
59
59
60
60
61 class ahbuartplugin : public socexplorerplugin
61 class ahbuartplugin : public socexplorerplugin
62 {
62 {
63 Q_OBJECT
63 Q_OBJECT
64 public:
64 public:
65 ahbuartplugin(QWidget *parent = 0);
65 ahbuartplugin(QWidget *parent = 0);
66 ~ahbuartplugin();
66 ~ahbuartplugin();
67 int registermenu(QMainWindow *menuHolder);
67 int registermenu(QMainWindow *menuHolder);
68 int VID(){return driver_VID;}
68 int VID(){return driver_VID;}
69 int PID(){return driver_PID;}
69 int PID(){return driver_PID;}
70
70
71 public slots:
71 public slots:
72 void togglePort(QString PortName,int baudrate);
72 void togglePort(QString PortName,int baudrate);
73 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
73 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
74 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
74 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
75 void closeMe();
75 void closeMe();
76 void close();
76 void close();
77 bool open(QString PortName,int baudrate);
77 bool open(QString PortName,int baudrate);
78 void updatePortList();
78 void updatePortList();
79 QVariantList ReadBytes(unsigned int address,unsigned int count);
79 QVariantList ReadBytes(unsigned int address,unsigned int count);
80 void WriteBytes(unsigned int address,QList<QVariant> dataList);
80 void WriteBytes(unsigned int address,QList<QVariant> dataList);
81 int detectSpeed();
82 void postInstantiationTrigger();
81 signals:
83 signals:
82 void setProgressValue(int progress);
84 void setProgressValue(int progress);
83 void addWritenBytes(int count);
85 void addWritenBytes(int count);
84 void addReadBytes(int count);
86 void addReadBytes(int count);
85 private:
87 private:
86 bool scanDone;
88 bool scanDone;
87 QProgressDialog* progress;
89 QProgressDialog* progress;
88 QLayout * mainLayout;
90 QLayout * mainLayout;
89 ahbUartPluginUI* UI;
91 ahbUartPluginUI* UI;
90 QMutex* portMutex;
92 QMutex* portMutex;
91 rs232port_t port;
93 rs232port_t port;
92 QCompleter *portListcompleter;
94 QCompleter *portListcompleter;
93 QStringListModel *portListcompleterModel;
95 QStringListModel *portListcompleterModel;
94 void connectPort(QString PortName,int baudrate);
96 void connectPort(QString PortName,int baudrate);
95 bool checkConnection();
97 bool checkConnection();
96
98
97 };
99 };
98
100
99 #endif // AHBUARTPLUGIN_H
101 #endif // AHBUARTPLUGIN_H
@@ -1,65 +1,62
1 #
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
3 #
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7 TEMPLATE = lib
7 TEMPLATE = lib
8 CONFIG += dll
8 CONFIG += dll
9 CONFIG -= static
9 CONFIG -= static
10 VERSION=1.4.0
10 VERSION=1.4.0
11 TARGET = ahbuartplugin #$${DEBUG_EXT}
11 TARGET = ahbuartplugin #$${DEBUG_EXT}
12 DEFINES += PLUGIN=ahbuartplugin
12 DEFINES += PLUGIN=ahbuartplugin
13 DEFINES += PLUGINHEADER="\"\\\"ahbuartplugin.h"\\\"\"
13 DEFINES += PLUGINHEADER="\"\\\"ahbuartplugin.h"\\\"\"
14 DEFINES += driver_Name="\"\\\"AHBUARTplugin"\\\"\"
14 DEFINES += driver_Name="\"\\\"AHBUARTplugin"\\\"\"
15 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
15 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
16 DEFINES += driver_Description="\"\\\"Gaisler's AHBUART driver, gives master access to AHB bus."\\\"\"
16 DEFINES += driver_Description="\"\\\"Gaisler's AHBUART driver, gives master access to AHB bus."\\\"\"
17 DEFINES += driver_can_be_root=1
17 DEFINES += driver_can_be_root=1
18 DEFINES += driver_can_be_child=0
18 DEFINES += driver_can_be_child=0
19 DEFINES += driver_VID=0
19 DEFINES += driver_VID=0
20 DEFINES += driver_PID=0
20 DEFINES += driver_PID=0
21
21
22
22
23
23
24
24
25 INCLUDEPATH += \
25 INCLUDEPATH += \
26 $${PWD}
26 $${PWD}
27
27
28
28
29 HEADERS += \
29 HEADERS += \
30 ahbuartplugin.h \
30 ahbuartplugin.h \
31 ahbuartpluginui.h \
31 ahbuartpluginui.h
32 ahbuartpywrapper.h \
32
33 ahbuartpywrapper.h
33
34
34
35
35 SOURCES += \
36
36 ahbuartplugin.cpp \
37 SOURCES += \
37 ahbuartpluginui.cpp
38 ahbuartplugin.cpp \
38
39 ahbuartpluginui.cpp \
39 FORMS += \
40 ahbuartpywrapper.cpp
40 ahbuartpluginui.ui
41
41
42 FORMS += \
42
43 ahbuartpluginui.ui
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
64
65
@@ -1,103 +1,121
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "ahbuartpluginui.h"
22 #include "ahbuartpluginui.h"
23 #include "ui_ahbuartpluginui.h"
23 #include "ui_ahbuartpluginui.h"
24
24
25 ahbUartPluginUI::ahbUartPluginUI(QWidget *parent) :
25 ahbUartPluginUI::ahbUartPluginUI(QWidget *parent) :
26 QWidget(parent),
26 QWidget(parent),
27 ui(new Ui::ahbUartPluginUI)
27 ui(new Ui::ahbUartPluginUI)
28 {
28 {
29 ui->setupUi(this);
29 ui->setupUi(this);
30 connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort()));
30 connect(ui->OpenPort,SIGNAL(clicked()),this,SLOT(connectPort()));
31 // connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int)));
31 // connect(ui->PortspeedSlider,SIGNAL(valueChanged(int)),ui->baurateLCD,SLOT(display(int)));
32 connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts()));
32 connect(ui->rescanPorts,SIGNAL(clicked()),this,SIGNAL(rescanPorts()));
33 QStringList allowedSpeeds;
33 QStringList allowedSpeeds;
34 allowedSpeeds<<"0"<<"50"<<"75"<<"110"<<"134"<<"150"<<
34 allowedSpeeds<<"0"<<"50"<<"75"<<"110"<<"134"<<"150"<<
35 "200"<<"300"<<"600"<<"1200"<<"1800"<<"2400"<<
35 "200"<<"300"<<"600"<<"1200"<<"1800"<<"2400"<<
36 "4800"<<"9600"<<"19200"<<"38400"<<"57600"<<
36 "4800"<<"9600"<<"19200"<<"38400"<<"57600"<<
37 "115200"<<"230400"<<"460800"<<"500000"<<"576000"<<
37 "115200"<<"230400"<<"460800"<<"500000"<<"576000"<<
38 "921600"<<"1000000"<<"1152000"<<"1500000"<<"2000000"<<
38 "921600"<<"1000000"<<"1152000"<<"1500000"<<"2000000"<<
39 "2500000"<<"3000000"<<"3500000"<<"4000000";
39 "2500000"<<"3000000"<<"3500000"<<"4000000";
40
40
41 portSpeedCompleter = new QCompleter(allowedSpeeds);
41 portSpeedCompleter = new QCompleter(allowedSpeeds);
42 this->ui->portSpeed->setCompleter(portSpeedCompleter);
42 this->ui->portSpeed->setCompleter(portSpeedCompleter);
43 this->writtenBytes = 0;
43 this->writtenBytes = 0;
44 this->readBytes = 0;
44 this->readBytes = 0;
45 }
45 }
46
46
47 void ahbUartPluginUI::connectPort()
47 void ahbUartPluginUI::connectPort()
48 {
48 {
49 int baudrate = ui->portSpeed->text().toInt();
49 int baudrate = ui->portSpeed->text().toInt();
50 emit this->connectPortsig(ui->PortName->text(),baudrate);
50 emit this->connectPortsig(ui->PortName->text(),baudrate);
51 }
51 }
52
52
53 void ahbUartPluginUI::setConnected(bool connected)
53 void ahbUartPluginUI::setConnected(bool connected)
54 {
54 {
55 if(connected == true)
55 if(connected == true)
56 {
56 {
57 ui->OpenPort->setText(tr("Close port"));
57 ui->OpenPort->setText(tr("Close port"));
58 }
58 }
59 else
59 else
60 ui->OpenPort->setText(tr("Open port"));
60 ui->OpenPort->setText(tr("Open port"));
61 }
61 }
62
62
63
63
64 ahbUartPluginUI::~ahbUartPluginUI()
64 ahbUartPluginUI::~ahbUartPluginUI()
65 {
65 {
66 delete ui;
66 delete ui;
67 }
67 }
68
68
69
69
70 void ahbUartPluginUI::setconfig(QString PortName, int baudrate)
70 void ahbUartPluginUI::setconfig(QString PortName, int baudrate)
71 {
71 {
72 this->ui->PortName->setText(PortName);
72 this->ui->PortName->setText(PortName);
73 this->ui->portSpeed->setText(QString::number(baudrate));
73 this->ui->portSpeed->setText(QString::number(baudrate));
74 }
74 }
75
75
76 void ahbUartPluginUI::addWritenBytes(int count)
76 void ahbUartPluginUI::addWritenBytes(int count)
77 {
77 {
78 this->writtenBytes+=count;
78 this->writtenBytes+=count;
79 this->ui->WrBytesLCD->display(this->writtenBytes);
79 this->ui->WrBytesLCD->display(this->writtenBytes);
80 }
80 }
81
81
82 void ahbUartPluginUI::addReadBytes(int count)
82 void ahbUartPluginUI::addReadBytes(int count)
83 {
83 {
84 this->readBytes+=count;
84 this->readBytes+=count;
85 this->ui->RdBytesLCD->display(this->readBytes);
85 this->ui->RdBytesLCD->display(this->readBytes);
86 }
86 }
87
87
88 void ahbUartPluginUI::setSystemSpeed(int speed)
89 {
90 QStringList frLst = QStringList()<<"Hz"<<"kHz"<<"MHz"<<"GHz";
91 int ind=0;
92 double speedD = speed;
93 while(speedD>1000.0)
94 {
95 speedD/=1000.0;
96 ind++;
97 }
98 this->ui->detectedSpeedLbl->setText(QString::number(speedD)+frLst[ind]);
99 }
100
88
101
89 void ahbUartPluginUI::setCompleter(QCompleter *completer)
102 void ahbUartPluginUI::setCompleter(QCompleter *completer)
90 {
103 {
91 this->ui->PortName->setCompleter(completer);
104 this->ui->PortName->setCompleter(completer);
92 }
105 }
93
106
107 int ahbUartPluginUI::baudRate()
108 {
109 return ui->portSpeed->text().toInt();
110 }
111
94 void ahbUartPluginUI::closeEvent(QCloseEvent *event)
112 void ahbUartPluginUI::closeEvent(QCloseEvent *event)
95 {
113 {
96 event->accept();
114 event->accept();
97 }
115 }
98
116
99
117
100
118
101
119
102
120
103
121
@@ -1,69 +1,71
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef AHBUARTPLUGINUI_H
22 #ifndef AHBUARTPLUGINUI_H
23 #define AHBUARTPLUGINUI_H
23 #define AHBUARTPLUGINUI_H
24
24
25 #include <QWidget>
25 #include <QWidget>
26 #include <QFile>
26 #include <QFile>
27 #include <QTextStream>
27 #include <QTextStream>
28 #include <QFileDialog>
28 #include <QFileDialog>
29 #include <QDir>
29 #include <QDir>
30 #include <QCloseEvent>
30 #include <QCloseEvent>
31 #include <QCompleter>
31 #include <QCompleter>
32
32
33 namespace Ui {
33 namespace Ui {
34 class ahbUartPluginUI;
34 class ahbUartPluginUI;
35 }
35 }
36
36
37 class ahbUartPluginUI : public QWidget
37 class ahbUartPluginUI : public QWidget
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 explicit ahbUartPluginUI(QWidget *parent = 0);
42 explicit ahbUartPluginUI(QWidget *parent = 0);
43 ~ahbUartPluginUI();
43 ~ahbUartPluginUI();
44 void closeEvent(QCloseEvent *event);
44 void closeEvent(QCloseEvent *event);
45 void setCompleter(QCompleter* completer);
45 void setCompleter(QCompleter* completer);
46 int baudRate();
46 public slots:
47 public slots:
47 void setConnected(bool connected);
48 void setConnected(bool connected);
48 void connectPort();
49 void connectPort();
49 void setconfig(QString PortName,int baudrate);
50 void setconfig(QString PortName,int baudrate);
50 void addWritenBytes(int count);
51 void addWritenBytes(int count);
51 void addReadBytes(int count);
52 void addReadBytes(int count);
53 void setSystemSpeed(int speed);
52
54
53 signals:
55 signals:
54 void connectPortsig(QString PortName,int baudrate);
56 void connectPortsig(QString PortName,int baudrate);
55 void setLogFileName(QString FileName);
57 void setLogFileName(QString FileName);
56 void rescanPorts();
58 void rescanPorts();
57 private:
59 private:
58 int writtenBytes;
60 int writtenBytes;
59 int readBytes;
61 int readBytes;
60 Ui::ahbUartPluginUI *ui;
62 Ui::ahbUartPluginUI *ui;
61 QCompleter* portSpeedCompleter;
63 QCompleter* portSpeedCompleter;
62 };
64 };
63
65
64 #endif // AHBUARTPLUGINUI_H
66 #endif // AHBUARTPLUGINUI_H
65
67
66
68
67
69
68
70
69
71
@@ -1,118 +1,135
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
2 <ui version="4.0">
3 <class>ahbUartPluginUI</class>
3 <class>ahbUartPluginUI</class>
4 <widget class="QWidget" name="ahbUartPluginUI">
4 <widget class="QWidget" name="ahbUartPluginUI">
5 <property name="geometry">
5 <property name="geometry">
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>884</width>
9 <width>902</width>
10 <height>221</height>
10 <height>256</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
14 <string>Form</string>
14 <string>Form</string>
15 </property>
15 </property>
16 <layout class="QGridLayout" name="gridLayout_2">
16 <layout class="QGridLayout" name="gridLayout_2">
17 <item row="4" column="0" colspan="3">
17 <item row="5" column="0" colspan="3">
18 <widget class="QGroupBox" name="Statistiques">
18 <widget class="QGroupBox" name="Statistiques">
19 <property name="title">
19 <property name="title">
20 <string>Statistics</string>
20 <string>Statistics</string>
21 </property>
21 </property>
22 <layout class="QGridLayout" name="gridLayout">
22 <layout class="QGridLayout" name="gridLayout">
23 <item row="0" column="2">
23 <item row="0" column="2">
24 <widget class="QLCDNumber" name="WrBytesLCD">
24 <widget class="QLCDNumber" name="WrBytesLCD">
25 <property name="digitCount">
25 <property name="digitCount">
26 <number>8</number>
26 <number>8</number>
27 </property>
27 </property>
28 <property name="segmentStyle">
28 <property name="segmentStyle">
29 <enum>QLCDNumber::Flat</enum>
29 <enum>QLCDNumber::Flat</enum>
30 </property>
30 </property>
31 </widget>
31 </widget>
32 </item>
32 </item>
33 <item row="1" column="2">
33 <item row="1" column="2">
34 <widget class="QLCDNumber" name="RdBytesLCD">
34 <widget class="QLCDNumber" name="RdBytesLCD">
35 <property name="digitCount">
35 <property name="digitCount">
36 <number>8</number>
36 <number>8</number>
37 </property>
37 </property>
38 <property name="segmentStyle">
38 <property name="segmentStyle">
39 <enum>QLCDNumber::Flat</enum>
39 <enum>QLCDNumber::Flat</enum>
40 </property>
40 </property>
41 </widget>
41 </widget>
42 </item>
42 </item>
43 <item row="1" column="0">
43 <item row="1" column="0">
44 <widget class="QLabel" name="RdBytesLbl">
44 <widget class="QLabel" name="RdBytesLbl">
45 <property name="text">
45 <property name="text">
46 <string>Read Bytes</string>
46 <string>Read Bytes</string>
47 </property>
47 </property>
48 </widget>
48 </widget>
49 </item>
49 </item>
50 <item row="0" column="0">
50 <item row="0" column="0">
51 <widget class="QLabel" name="WrBytesLbl">
51 <widget class="QLabel" name="WrBytesLbl">
52 <property name="text">
52 <property name="text">
53 <string>Writen Bytes</string>
53 <string>Writen Bytes</string>
54 </property>
54 </property>
55 </widget>
55 </widget>
56 </item>
56 </item>
57 </layout>
57 </layout>
58 </widget>
58 </widget>
59 </item>
59 </item>
60 <item row="1" column="0">
60 <item row="1" column="0">
61 <widget class="QLabel" name="label_2">
61 <widget class="QLabel" name="label_2">
62 <property name="text">
62 <property name="text">
63 <string>Port Speed</string>
63 <string>Port Speed</string>
64 </property>
64 </property>
65 </widget>
65 </widget>
66 </item>
66 </item>
67 <item row="0" column="0">
67 <item row="0" column="0">
68 <widget class="QLabel" name="label">
68 <widget class="QLabel" name="label">
69 <property name="text">
69 <property name="text">
70 <string>Port Name</string>
70 <string>Port Name</string>
71 </property>
71 </property>
72 </widget>
72 </widget>
73 </item>
73 </item>
74 <item row="0" column="2">
74 <item row="0" column="2">
75 <widget class="QPushButton" name="rescanPorts">
75 <widget class="QPushButton" name="rescanPorts">
76 <property name="text">
76 <property name="text">
77 <string>SCAN</string>
77 <string>SCAN</string>
78 </property>
78 </property>
79 </widget>
79 </widget>
80 </item>
80 </item>
81 <item row="0" column="1">
81 <item row="0" column="1">
82 <widget class="QLineEdit" name="PortName"/>
82 <widget class="QLineEdit" name="PortName"/>
83 </item>
83 </item>
84 <item row="3" column="0">
84 <item row="3" column="0">
85 <spacer name="verticalSpacer">
85 <spacer name="verticalSpacer">
86 <property name="orientation">
86 <property name="orientation">
87 <enum>Qt::Vertical</enum>
87 <enum>Qt::Vertical</enum>
88 </property>
88 </property>
89 <property name="sizeHint" stdset="0">
89 <property name="sizeHint" stdset="0">
90 <size>
90 <size>
91 <width>20</width>
91 <width>20</width>
92 <height>40</height>
92 <height>40</height>
93 </size>
93 </size>
94 </property>
94 </property>
95 </spacer>
95 </spacer>
96 </item>
96 </item>
97 <item row="3" column="1" colspan="2">
97 <item row="3" column="1" colspan="2">
98 <widget class="QPushButton" name="OpenPort">
98 <widget class="QPushButton" name="OpenPort">
99 <property name="text">
99 <property name="text">
100 <string>Open Port</string>
100 <string>Open Port</string>
101 </property>
101 </property>
102 </widget>
102 </widget>
103 </item>
103 </item>
104 <item row="1" column="1" colspan="2">
104 <item row="1" column="1" colspan="2">
105 <widget class="QLineEdit" name="portSpeed">
105 <widget class="QLineEdit" name="portSpeed">
106 <property name="inputMask">
106 <property name="inputMask">
107 <string>00000000</string>
107 <string>00000000</string>
108 </property>
108 </property>
109 <property name="text">
109 <property name="text">
110 <string>115200</string>
110 <string>115200</string>
111 </property>
111 </property>
112 </widget>
112 </widget>
113 </item>
113 </item>
114 <item row="4" column="0">
115 <widget class="QLabel" name="label_3">
116 <property name="text">
117 <string>Detected Speed</string>
118 </property>
119 </widget>
120 </item>
121 <item row="4" column="1" colspan="2">
122 <widget class="QLabel" name="detectedSpeedLbl">
123 <property name="text">
124 <string/>
125 </property>
126 <property name="alignment">
127 <set>Qt::AlignCenter</set>
128 </property>
129 </widget>
130 </item>
114 </layout>
131 </layout>
115 </widget>
132 </widget>
116 <resources/>
133 <resources/>
117 <connections/>
134 <connections/>
118 </ui>
135 </ui>
@@ -1,333 +1,333
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "dsu3plugin.h"
22 #include "dsu3plugin.h"
23 #include <QFileDialog>
23 #include <QFileDialog>
24 #include <QDir>
24 #include <QDir>
25 #include "dsu3pluginpywrapper.h"
25 #include "dsu3pluginpywrapper.h"
26 #include <socexplorerengine.h>
26 #include <socexplorerengine.h>
27
27
28
28
29 struct acceptedMemctrlr_str
29 struct acceptedMemctrlr_str
30 {
30 {
31 int vid;
31 int vid;
32 int pid;
32 int pid;
33 const char* name;
33 const char* name;
34 };
34 };
35
35
36 const struct acceptedMemctrlr_str acceptedMemctrlr[]=
36 const struct acceptedMemctrlr_str acceptedMemctrlr[]=
37 {
37 {
38 {0x04,0x0f,"MCTRL"},
38 {0x04,0x0f,"MCTRL"},
39 {0x01,0x51,"FTSRCTRL"},
39 {0x01,0x51,"FTSRCTRL"},
40 {0x20,0x01,"SRCTRLE_0WS" },
40 {0x20,0x01,"SRCTRLE_0WS" },
41 {0x20,0x02,"SRCTRLE_1WS" }
41 {0x20,0x02,"SRCTRLE_1WS" }
42 };
42 };
43
43
44 #define acceptedMemctrlrCnt 4
44 #define acceptedMemctrlrCnt 4
45
45
46 dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false)
46 dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false)
47 {
47 {
48 this->UI = new dsu3pluginui();
48 this->UI = new dsu3pluginui();
49 this->setWidget((QWidget*)this->UI);
49 this->setWidget((QWidget*)this->UI);
50 this->elfparserInst = new elfparser();
50 this->elfparserInst = new elfparser();
51 this->pyObject = new dsu3pluginPywrapper(this);
51 // this->pyObject = new dsu3pluginPywrapper(this);
52 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString)));
52 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString)));
53 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
53 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
54 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
54 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
55 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
55 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
56 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheEnable()),this,SLOT(cacheEnable()));
56 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheEnable()),this,SLOT(cacheEnable()));
57 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheDisable()),this,SLOT(cacheDisable()));
57 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheDisable()),this,SLOT(cacheDisable()));
58 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(setCacheEnable(bool)),this,SLOT(setCacheEnable(bool)));
58 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(setCacheEnable(bool)),this,SLOT(setCacheEnable(bool)));
59
59
60 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
60 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
61 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
61 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
62 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
62 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
63 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
63 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
64 this->running = false;
64 this->running = false;
65 }
65 }
66
66
67
67
68 dsu3plugin::~dsu3plugin()
68 dsu3plugin::~dsu3plugin()
69 {
69 {
70
70
71 }
71 }
72
72
73
73
74 void dsu3plugin::openFile()
74 void dsu3plugin::openFile()
75 {
75 {
76 QString filename = QFileDialog::getOpenFileName(this,tr("Open elf File"), QDir::homePath(), tr("Elf Files (*)"));
76 QString filename = QFileDialog::getOpenFileName(this,tr("Open elf File"), QDir::homePath(), tr("Elf Files (*)"));
77 if(filename!="")
77 if(filename!="")
78 {
78 {
79 this->openFile(filename);
79 this->openFile(filename);
80 }
80 }
81 }
81 }
82
82
83 void dsu3plugin::openFile(QString fileName)
83 void dsu3plugin::openFile(QString fileName)
84 {
84 {
85 this->elfparserInst->setFilename(fileName);
85 this->elfparserInst->setFilename(fileName);
86 emit this->updateInfo(this->elfparserInst);
86 emit this->updateInfo(this->elfparserInst);
87 }
87 }
88
88
89 bool dsu3plugin::configureTarget()
89 bool dsu3plugin::configureTarget()
90 {
90 {
91 int detectedMctrlr=-1;
91 int detectedMctrlr=-1;
92 if(parent==NULL)
92 if(parent==NULL)
93 return false;
93 return false;
94 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
94 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
95 if(DSUBASEADDRESS == (unsigned int)-1)
95 if(DSUBASEADDRESS == (unsigned int)-1)
96 DSUBASEADDRESS = 0x90000000;
96 DSUBASEADDRESS = 0x90000000;
97 unsigned int MCTRLBASEADDRESS =-1;
97 unsigned int MCTRLBASEADDRESS =-1;
98 for(int i=0; i<acceptedMemctrlrCnt;i++)
98 for(int i=0; i<acceptedMemctrlrCnt;i++)
99 {
99 {
100 MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,acceptedMemctrlr[i].vid , acceptedMemctrlr[i].pid,0);
100 MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,acceptedMemctrlr[i].vid , acceptedMemctrlr[i].pid,0);
101 if(MCTRLBASEADDRESS != (unsigned int)-1)
101 if(MCTRLBASEADDRESS != (unsigned int)-1)
102 {
102 {
103 SocExplorerEngine::message(this,QString("Found %1 @%2").arg(acceptedMemctrlr[i].name).arg(MCTRLBASEADDRESS,8,16),1);
103 SocExplorerEngine::message(this,QString("Found %1 @%2").arg(acceptedMemctrlr[i].name).arg(MCTRLBASEADDRESS,8,16),1);
104 detectedMctrlr=i;
104 detectedMctrlr=i;
105 break;
105 break;
106 }
106 }
107 }
107 }
108 if(MCTRLBASEADDRESS == (unsigned int)-1)
108 if(MCTRLBASEADDRESS == (unsigned int)-1)
109 {
109 {
110 SocExplorerEngine::message(this,"Can't any compatible memory controller",1);
110 SocExplorerEngine::message(this,"Can't any compatible memory controller",1);
111 return false;
111 return false;
112 }
112 }
113
113
114
114
115 //Force a debug break
115 //Force a debug break
116 WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS);
116 WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS);
117 WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20);
117 WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20);
118 //Clear time tag counter
118 //Clear time tag counter
119 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8);
119 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8);
120
120
121 //Clear ASR registers
121 //Clear ASR registers
122 WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040);
122 WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040);
123 WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024);
123 WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024);
124 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
124 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
125 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48);
125 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48);
126 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
126 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
127 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
127 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
128
128
129 // {0x04,0x0f,"MCTRL"},
129 // {0x04,0x0f,"MCTRL"},
130 // {0x01,0x51,"FTSRCTRL"},
130 // {0x01,0x51,"FTSRCTRL"},
131 // {0x20,0x01,"SRCTRLE_0WS" },
131 // {0x20,0x01,"SRCTRLE_0WS" },
132 // {0x20,0x02,"SRCTRLE_1WS" }
132 // {0x20,0x02,"SRCTRLE_1WS" }
133 if(QString(acceptedMemctrlr[detectedMctrlr].name)=="MCTRL" || QString(acceptedMemctrlr[detectedMctrlr].name)=="FTSRCTRL" )
133 if(QString(acceptedMemctrlr[detectedMctrlr].name)=="MCTRL" || QString(acceptedMemctrlr[detectedMctrlr].name)=="FTSRCTRL" )
134 {
134 {
135 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
135 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
136 }
136 }
137 if(QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_0WS" || QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_1WS" )
137 if(QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_0WS" || QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_1WS" )
138 {
138 {
139 //let's perform a mem Wash
139 //let's perform a mem Wash
140 unsigned int val = ReadReg(MCTRLBASEADDRESS);
140 unsigned int val = ReadReg(MCTRLBASEADDRESS);
141 val |=1<<31;
141 val |=1<<31;
142 WriteRegs(uIntlist()<<val,(unsigned int)MCTRLBASEADDRESS);
142 WriteRegs(uIntlist()<<val,(unsigned int)MCTRLBASEADDRESS);
143 usleep(1000*1000);
143 usleep(1000*1000);
144 }
144 }
145
145
146
146
147 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
147 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
148 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
148 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
149
149
150 memSet(DSUBASEADDRESS+0x300000,0,1567);
150 memSet(DSUBASEADDRESS+0x300000,0,1567);
151 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
151 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
152 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);
152 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);
153 WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS);
153 WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS);
154
154
155 //Disable interrupts
155 //Disable interrupts
156 unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0);
156 unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0);
157 if(APBIRQCTRLRBASEADD == (unsigned int)-1)
157 if(APBIRQCTRLRBASEADD == (unsigned int)-1)
158 return false;
158 return false;
159 WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040);
159 WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040);
160 WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080);
160 WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080);
161 WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD);
161 WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD);
162
162
163 //Set up timer
163 //Set up timer
164 unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0);
164 unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0);
165 if(APBTIMERBASEADD == (unsigned int)-1)
165 if(APBTIMERBASEADD == (unsigned int)-1)
166 return false;
166 return false;
167 WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014);
167 WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014);
168 WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04);
168 WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04);
169 WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018);
169 WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018);
170 return true;
170 return true;
171 }
171 }
172
172
173 bool dsu3plugin::cacheDisable()
173 bool dsu3plugin::cacheDisable()
174 {
174 {
175 return setCacheEnable(false);
175 return setCacheEnable(false);
176 }
176 }
177
177
178 bool dsu3plugin::cacheEnable()
178 bool dsu3plugin::cacheEnable()
179 {
179 {
180 return setCacheEnable(true);
180 return setCacheEnable(true);
181 }
181 }
182
182
183 bool dsu3plugin::setCacheEnable(bool enabled)
183 bool dsu3plugin::setCacheEnable(bool enabled)
184 {
184 {
185 if(parent==NULL)
185 if(parent==NULL)
186 return false;
186 return false;
187 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
187 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
188 if(DSUBASEADDRESS == (unsigned int)-1)
188 if(DSUBASEADDRESS == (unsigned int)-1)
189 DSUBASEADDRESS = 0x90000000;
189 DSUBASEADDRESS = 0x90000000;
190 WriteRegs(uIntlist()<<2,DSUBASEADDRESS+0x400024);
190 WriteRegs(uIntlist()<<2,DSUBASEADDRESS+0x400024);
191 unsigned int reg = ReadReg(DSUBASEADDRESS+0x700000);
191 unsigned int reg = ReadReg(DSUBASEADDRESS+0x700000);
192 if(enabled)
192 if(enabled)
193 {
193 {
194 WriteRegs(uIntlist()<<(0x0001000F|reg),DSUBASEADDRESS+0x700000);
194 WriteRegs(uIntlist()<<(0x0001000F|reg),DSUBASEADDRESS+0x700000);
195 //flushes cache.
195 //flushes cache.
196 WriteRegs(uIntlist()<<(0x0061000F|reg),DSUBASEADDRESS+0x700000);
196 WriteRegs(uIntlist()<<(0x0061000F|reg),DSUBASEADDRESS+0x700000);
197 }
197 }
198 else
198 else
199 {
199 {
200 WriteRegs(uIntlist()<<((!0x0001000F)&reg),DSUBASEADDRESS+0x700000);
200 WriteRegs(uIntlist()<<((!0x0001000F)&reg),DSUBASEADDRESS+0x700000);
201 WriteRegs(uIntlist()<<(0x00600000|reg),DSUBASEADDRESS+0x700000);
201 WriteRegs(uIntlist()<<(0x00600000|reg),DSUBASEADDRESS+0x700000);
202 }
202 }
203 return true;
203 return true;
204 }
204 }
205
205
206 bool dsu3plugin::flashTarget()
206 bool dsu3plugin::flashTarget()
207 {
207 {
208 stop();
208 stop();
209 cacheDisable();
209 cacheDisable();
210 configureTarget();
210 configureTarget();
211 /*Write .text*/
211 /*Write .text*/
212 this->writeSection(".text");
212 this->writeSection(".text");
213 /*Write .data*/
213 /*Write .data*/
214 this->writeSection(".data");
214 this->writeSection(".data");
215 return true;
215 return true;
216 }
216 }
217
217
218 void dsu3plugin::run()
218 void dsu3plugin::run()
219 {
219 {
220 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
220 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
221 if(DSUBASEADDRESS == (unsigned int)-1)
221 if(DSUBASEADDRESS == (unsigned int)-1)
222 DSUBASEADDRESS = 0x90000000;
222 DSUBASEADDRESS = 0x90000000;
223 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
223 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
224 this->running = true;
224 this->running = true;
225 this->UI->setRunning(true);
225 this->UI->setRunning(true);
226 }
226 }
227
227
228 void dsu3plugin::stop()
228 void dsu3plugin::stop()
229 {
229 {
230 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
230 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
231 if(DSUBASEADDRESS == (unsigned int)-1)
231 if(DSUBASEADDRESS == (unsigned int)-1)
232 DSUBASEADDRESS = 0x90000000;
232 DSUBASEADDRESS = 0x90000000;
233 WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020);
233 WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020);
234 this->running = false;
234 this->running = false;
235 this->UI->setRunning(false);
235 this->UI->setRunning(false);
236 }
236 }
237
237
238 void dsu3plugin::toggleRun()
238 void dsu3plugin::toggleRun()
239 {
239 {
240 if(this->running)
240 if(this->running)
241 this->stop();
241 this->stop();
242 else
242 else
243 this->run();
243 this->run();
244 }
244 }
245
245
246 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
246 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
247 {
247 {
248 unsigned int* buff;
248 unsigned int* buff;
249 buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int));
249 buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int));
250 for(int i=0;i<Values.count();i++)
250 for(int i=0;i<Values.count();i++)
251 {
251 {
252 buff[i]=Values.at(i);
252 buff[i]=Values.at(i);
253 }
253 }
254 parent->Write(buff,(unsigned int)Values.count(),address);
254 parent->Write(buff,(unsigned int)Values.count(),address);
255 free(buff);
255 free(buff);
256 }
256 }
257
257
258 unsigned int dsu3plugin::ReadReg(unsigned int address)
258 unsigned int dsu3plugin::ReadReg(unsigned int address)
259 {
259 {
260 unsigned int buff;
260 unsigned int buff;
261 parent->Read(&buff,1,address);
261 parent->Read(&buff,1,address);
262 return buff;
262 return buff;
263 }
263 }
264
264
265 void dsu3plugin::writeSection(int index)
265 void dsu3plugin::writeSection(int index)
266 {
266 {
267 char* buffch=NULL;
267 char* buffch=NULL;
268 unsigned int* buff;
268 unsigned int* buff;
269 int size = this->elfparserInst->getSectionDatasz(index);
269 int size = this->elfparserInst->getSectionDatasz(index);
270 int sizeInt = size/4;
270 int sizeInt = size/4;
271 if(parent==NULL)
271 if(parent==NULL)
272 return;
272 return;
273 this->elfparserInst->getSectionData(index,&buffch);
273 this->elfparserInst->getSectionData(index,&buffch);
274 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
274 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
275 for(int i=0;i<sizeInt;i++)
275 for(int i=0;i<sizeInt;i++)
276 {
276 {
277 buff[i] = 0x0FF & ((unsigned int)buffch[4*i]);
277 buff[i] = 0x0FF & ((unsigned int)buffch[4*i]);
278 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1]));
278 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1]));
279 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2]));
279 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2]));
280 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3]));
280 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3]));
281 }
281 }
282 if(size%4)
282 if(size%4)
283 {
283 {
284 buff[sizeInt]=0;
284 buff[sizeInt]=0;
285 for(int i=(size%4);i>0;i--)
285 for(int i=(size%4);i>0;i--)
286 {
286 {
287 buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i]));
287 buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i]));
288 }
288 }
289 sizeInt++;
289 sizeInt++;
290 }
290 }
291 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index));
291 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index));
292 free(buff);
292 free(buff);
293 }
293 }
294
294
295 void dsu3plugin::writeSection(const QString &name)
295 void dsu3plugin::writeSection(const QString &name)
296 {
296 {
297 for(int i=0;i<this->elfparserInst->getSectioncount();i++)
297 for(int i=0;i<this->elfparserInst->getSectioncount();i++)
298 {
298 {
299 if(!this->elfparserInst->getSectionName(i).compare(name))
299 if(!this->elfparserInst->getSectionName(i).compare(name))
300 {
300 {
301 printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i));
301 printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i));
302 writeSection(i);
302 writeSection(i);
303 }
303 }
304 }
304 }
305 }
305 }
306
306
307
307
308 unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
308 unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
309 {
309 {
310 if(parent!=NULL)
310 if(parent!=NULL)
311 return parent->Write(Value,count,address);
311 return parent->Write(Value,count,address);
312 return 0;
312 return 0;
313 }
313 }
314
314
315 bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count)
315 bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count)
316 {
316 {
317 unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int));
317 unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int));
318 if(buffer!=NULL)
318 if(buffer!=NULL)
319 {
319 {
320 memset((void*)buffer,value,count*sizeof(unsigned int));
320 memset((void*)buffer,value,count*sizeof(unsigned int));
321 parent->Write(buffer,count,address);
321 parent->Write(buffer,count,address);
322 free(buffer );
322 free(buffer );
323 return true;
323 return true;
324 }
324 }
325 return false;
325 return false;
326 }
326 }
327
327
328 unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address)
328 unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address)
329 {
329 {
330 if(parent!=NULL)
330 if(parent!=NULL)
331 return parent->Read(Value,count,address);
331 return parent->Read(Value,count,address);
332 return 0;
332 return 0;
333 }
333 }
@@ -1,68 +1,70
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef DSU3PLUGIN_H
22 #ifndef DSU3PLUGIN_H
23 #define DSU3PLUGIN_H
23 #define DSU3PLUGIN_H
24 #include "dsu3pluginui.h"
24 #include "dsu3pluginui.h"
25 #include <QMenuBar>
25 #include <QMenuBar>
26 #include <QMenu>
26 #include <QMenu>
27 #include <QAction>
27 #include <QAction>
28 #include <QMainWindow>
28 #include <QMainWindow>
29 #include <QList>
29 #include <QList>
30 #include "elfparser.h"
30 #include "elfparser.h"
31 #include <socexplorerplugin.h>
31 #include <socexplorerplugin.h>
32 #include <socexplorerengine.h>
32 #include <socexplorerengine.h>
33
33
34 typedef QList<unsigned int> uIntlist;
34 typedef QList<unsigned int> uIntlist;
35
35
36 class dsu3plugin : public socexplorerplugin
36 class dsu3plugin : public socexplorerplugin
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit dsu3plugin(QWidget *parent = 0);
40 explicit dsu3plugin(QWidget *parent = 0);
41 ~dsu3plugin();
41 ~dsu3plugin();
42 bool memSet(unsigned int address, int value, unsigned int count);
42 bool memSet(unsigned int address, int value, unsigned int count);
43 public slots:
43 public slots:
44 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
44 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
45 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
45 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
46 void openFile();
46 void openFile();
47 void openFile(QString fileName);
47 void openFile(QString fileName);
48 bool configureTarget();
48 bool configureTarget();
49 bool cacheDisable();
49 bool cacheDisable();
50 bool cacheEnable();
50 bool cacheEnable();
51 bool setCacheEnable(bool enabled);
51 bool setCacheEnable(bool enabled);
52 bool flashTarget();
52 bool flashTarget();
53 void run();
53 void run();
54 void stop();
54 void stop();
55 void toggleRun();
55 void toggleRun();
56 //added for python backward compatibility
57 void loadFile(){this->flashTarget();}
56 signals:
58 signals:
57 void updateInfo(elfparser* parser);
59 void updateInfo(elfparser* parser);
58 private:
60 private:
59 void WriteRegs(uIntlist Values, unsigned int address);
61 void WriteRegs(uIntlist Values, unsigned int address);
60 unsigned int ReadReg(unsigned int address);
62 unsigned int ReadReg(unsigned int address);
61 void writeSection(int index);
63 void writeSection(int index);
62 void writeSection(const QString& name);
64 void writeSection(const QString& name);
63 dsu3pluginui* UI;
65 dsu3pluginui* UI;
64 elfparser* elfparserInst;
66 elfparser* elfparserInst;
65 bool running;
67 bool running;
66 };
68 };
67
69
68 #endif // DSU3PLUGIN_H
70 #endif // DSU3PLUGIN_H
@@ -1,68 +1,66
1 #
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
3 #
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7
7
8 TEMPLATE = lib
8 TEMPLATE = lib
9
9
10 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
10 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
11 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
11 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
12
12
13 VERSION=0.2.0
13 VERSION=0.2.0
14 TARGET = dsu3plugin #$${DEBUG_EXT}
14 TARGET = dsu3plugin #$${DEBUG_EXT}
15
15
16 DEFINES += PLUGIN=dsu3plugin
16 DEFINES += PLUGIN=dsu3plugin
17 DEFINES += PLUGINHEADER="\"\\\"dsu3plugin.h"\\\"\"
17 DEFINES += PLUGINHEADER="\"\\\"dsu3plugin.h"\\\"\"
18 DEFINES += driver_Name="\"\\\"dsu3plugin"\\\"\"
18 DEFINES += driver_Name="\"\\\"dsu3plugin"\\\"\"
19 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
19 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
20 DEFINES += driver_Description="\"\\\"DSU driver, works with GAISLER's DSU3 unit."\\\"\"
20 DEFINES += driver_Description="\"\\\"DSU driver, works with GAISLER's DSU3 unit."\\\"\"
21 DEFINES += driver_can_be_root=0
21 DEFINES += driver_can_be_root=0
22 DEFINES += driver_can_be_child=1
22 DEFINES += driver_can_be_child=1
23 DEFINES += driver_VID=0x00
23 DEFINES += driver_VID=0x00
24 DEFINES += driver_PID=0x00
24 DEFINES += driver_PID=0x00
25
25
26
26
27 INCLUDEPATH += \
27 INCLUDEPATH += \
28 $${PWD}
28 $${PWD}
29
29
30
30
31
31
32 HEADERS += \
32 HEADERS += \
33 dsu3plugin.h \
33 dsu3plugin.h \
34 dsu3pluginui.h \
34 dsu3pluginui.h
35 dsu3pluginpywrapper.h
36
35
37 SOURCES += \
36 SOURCES += \
38 dsu3plugin.cpp \
37 dsu3plugin.cpp \
39 dsu3pluginui.cpp \
38 dsu3pluginui.cpp
40 dsu3pluginpywrapper.cpp
41
39
42
40
43
41
44
42
45
43
46
44
47
45
48
46
49
47
50
48
51
49
52
50
53
51
54
52
55
53
56
54
57
55
58
56
59
57
60
58
61
59
62
60
63
61
64
62
65
63
66
64
67
65
68
66
@@ -1,61 +1,61
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "genericrwplugin.h"
22 #include "genericrwplugin.h"
23 #include "genericrwpluginpywrapper.h"
23 #include "genericrwpluginpywrapper.h"
24 genericrwplugin::genericrwplugin(QWidget *parent):socexplorerplugin(parent,false)
24 genericrwplugin::genericrwplugin(QWidget *parent):socexplorerplugin(parent,false)
25 {
25 {
26 this->UI = new genericrwpluginUi();
26 this->UI = new genericrwpluginUi();
27 this->setWidget((QWidget*)this->UI);
27 this->setWidget((QWidget*)this->UI);
28 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
28 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
29 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
29 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
30 this->pyObject = new genericRWpluginPyWrapper(this);
30 // this->pyObject = new genericRWpluginPyWrapper(this);
31 //QObject::connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
31 // //QObject::connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
32 //QObject::connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
32 // //QObject::connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
33 QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(refresh()),this->UI,SIGNAL(refresh()));
33 // QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(refresh()),this->UI,SIGNAL(refresh()));
34 QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setAddress(quint32)),this->UI,SIGNAL(setAddress(quint32)));
34 // QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setAddress(quint32)),this->UI,SIGNAL(setAddress(quint32)));
35 QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setLength(quint32)),this->UI,SIGNAL(setLength(quint32)));
35 // QObject::connect(((genericRWpluginPyWrapper*)this->pyObject),SIGNAL(setLength(quint32)),this->UI,SIGNAL(setLength(quint32)));
36 }
36 }
37
37
38 genericrwplugin::~genericrwplugin()
38 genericrwplugin::~genericrwplugin()
39 {}
39 {}
40
40
41 int genericrwplugin::registermenu(QMainWindow *menuHolder)
41 int genericrwplugin::registermenu(QMainWindow *menuHolder)
42 {
42 {
43 this->menu = menuHolder->menuBar()->addMenu(tr("&Generic RW Driver"));
43 this->menu = menuHolder->menuBar()->addMenu(tr("&Generic RW Driver"));
44 this->closeAction = this->menu->addAction(tr("Close plugin"));
44 this->closeAction = this->menu->addAction(tr("Close plugin"));
45 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
45 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
46 return 1;
46 return 1;
47 }
47 }
48
48
49 unsigned int genericrwplugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
49 unsigned int genericrwplugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
50 {
50 {
51 if(parent!=NULL)
51 if(parent!=NULL)
52 return parent->Write(Value,count,address);
52 return parent->Write(Value,count,address);
53 return 0;
53 return 0;
54 }
54 }
55
55
56 unsigned int genericrwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
56 unsigned int genericrwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
57 {
57 {
58 if(parent!=NULL)
58 if(parent!=NULL)
59 return parent->Read(Value,count,address);
59 return parent->Read(Value,count,address);
60 return 0;
60 return 0;
61 }
61 }
@@ -1,48 +1,46
1 #
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
3 #
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7 CONFIG += dll
7 CONFIG += dll
8 CONFIG -= static
8 CONFIG -= static
9
9
10 VERSION=1.1.0
10 VERSION=1.1.0
11 TARGET = genericrwplugin
11 TARGET = genericrwplugin
12 DEFINES += PLUGIN=genericrwplugin
12 DEFINES += PLUGIN=genericrwplugin
13 DEFINES += PLUGINHEADER="\"\\\"genericrwplugin.h"\\\"\"
13 DEFINES += PLUGINHEADER="\"\\\"genericrwplugin.h"\\\"\"
14 DEFINES += driver_Name="\"\\\"GenericRWplugin"\\\"\"
14 DEFINES += driver_Name="\"\\\"GenericRWplugin"\\\"\"
15 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
15 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
16 DEFINES += driver_Description="\"\\\"Generic plugin, gives you R/W access to any memory area."\\\"\"
16 DEFINES += driver_Description="\"\\\"Generic plugin, gives you R/W access to any memory area."\\\"\"
17 DEFINES += driver_can_be_root=0
17 DEFINES += driver_can_be_root=0
18 DEFINES += driver_can_be_child=1
18 DEFINES += driver_can_be_child=1
19 DEFINES += driver_VID=0
19 DEFINES += driver_VID=0
20 DEFINES += driver_PID=0
20 DEFINES += driver_PID=0
21
21
22
22
23 INCLUDEPATH += \
23 INCLUDEPATH += \
24 $${PWD}
24 $${PWD}
25
25
26 #LIBS +=-llppmoncommon$${DEBUG_EXT}
26 #LIBS +=-llppmoncommon$${DEBUG_EXT}
27
27
28 HEADERS += \
28 HEADERS += \
29 genericrwplugin.h \
29 genericrwplugin.h \
30 genericrwpluginui.h \
30 genericrwpluginui.h \
31 memeditor.h \
31 memeditor.h
32 genericrwpluginpywrapper.h
33
32
34 SOURCES += \
33 SOURCES += \
35 genericrwplugin.cpp \
34 genericrwplugin.cpp \
36 genericrwpluginui.cpp \
35 genericrwpluginui.cpp \
37 memeditor.cpp \
36 memeditor.cpp
38 genericrwpluginpywrapper.cpp
39
37
40
38
41
39
42
40
43
41
44
42
45
43
46
44
47
45
48
46
@@ -1,85 +1,85
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "memctrlrplugin.h"
22 #include "memctrlrplugin.h"
23 #include "memctrlrpywrapper.h"
23 #include "memctrlrpywrapper.h"
24
24
25 memctrlrplugin::memctrlrplugin(QWidget *parent):socexplorerplugin(parent,false)
25 memctrlrplugin::memctrlrplugin(QWidget *parent):socexplorerplugin(parent,false)
26 {
26 {
27 this->UI = new memctrlrPluginUi();
27 this->UI = new memctrlrPluginUi();
28 this->setWidget((QWidget*)this->UI);
28 this->setWidget((QWidget*)this->UI);
29 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
29 connect(this->UI,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
30 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
30 connect(this->UI,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
31 this->pyObject = new memctrlrPyWrapper(this);
31 // this->pyObject = new memctrlrPyWrapper(this);
32 connect(this->pyObject,SIGNAL(launchTest(uint,uint)),this,SLOT(launchTest(uint,uint)));
32 // connect(this->pyObject,SIGNAL(launchTest(uint,uint)),this,SLOT(launchTest(uint,uint)));
33 }
33 }
34
34
35 memctrlrplugin::~memctrlrplugin()
35 memctrlrplugin::~memctrlrplugin()
36 {}
36 {}
37
37
38 int memctrlrplugin::registermenu(QMainWindow *menuHolder)
38 int memctrlrplugin::registermenu(QMainWindow *menuHolder)
39 {
39 {
40 this->menu = menuHolder->menuBar()->addMenu(tr("&Memory Controler"));
40 this->menu = menuHolder->menuBar()->addMenu(tr("&Memory Controler"));
41 this->closeAction = this->menu->addAction(tr("Close plugin"));
41 this->closeAction = this->menu->addAction(tr("Close plugin"));
42 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
42 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
43 return 1;
43 return 1;
44 }
44 }
45
45
46 unsigned int memctrlrplugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
46 unsigned int memctrlrplugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
47 {
47 {
48 if(parent)
48 if(parent)
49 return parent->Write(Value,count,address);
49 return parent->Write(Value,count,address);
50 return 0;
50 return 0;
51 }
51 }
52
52
53 unsigned int memctrlrplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
53 unsigned int memctrlrplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
54 {
54 {
55 if(parent)
55 if(parent)
56 return parent->Read(Value,count,address);
56 return parent->Read(Value,count,address);
57 return 0;
57 return 0;
58 }
58 }
59
59
60
60
61 bool memctrlrplugin::launchTest(unsigned int baseAddress,unsigned int size)
61 bool memctrlrplugin::launchTest(unsigned int baseAddress,unsigned int size)
62 {
62 {
63 if(parent==NULL)return false;
63 if(parent==NULL)return false;
64 unsigned int* dataLocal = (unsigned int*)malloc(size);
64 unsigned int* dataLocal = (unsigned int*)malloc(size);
65 unsigned int* dataOnBoard = (unsigned int*)malloc(size);
65 unsigned int* dataOnBoard = (unsigned int*)malloc(size);
66 bool res=true;
66 bool res=true;
67 for(int i=0;(unsigned int)i<(size>>2);i++)
67 for(int i=0;(unsigned int)i<(size>>2);i++)
68 {
68 {
69 dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
69 dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
70 }
70 }
71 parent->Write(dataLocal,size>>2,baseAddress);
71 parent->Write(dataLocal,size>>2,baseAddress);
72 parent->Read(dataOnBoard,size>>2,baseAddress);
72 parent->Read(dataOnBoard,size>>2,baseAddress);
73 for(int i=0;(unsigned int)i<(size>>2);i++)
73 for(int i=0;(unsigned int)i<(size>>2);i++)
74 {
74 {
75 if(dataLocal[i]!=dataOnBoard[i])
75 if(dataLocal[i]!=dataOnBoard[i])
76 res=false;
76 res=false;
77 }
77 }
78
78
79 free(dataLocal);
79 free(dataLocal);
80 free(dataOnBoard);
80 free(dataOnBoard);
81 return res;
81 return res;
82 }
82 }
83
83
84
84
85
85
@@ -1,67 +1,65
1 #
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
3 #
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7 CONFIG += dll
7 CONFIG += dll
8 CONFIG -= static
8 CONFIG -= static
9
9
10 VERSION=1.0.1
10 VERSION=1.0.1
11 TARGET = memctrlrplugin
11 TARGET = memctrlrplugin
12 DEFINES += PLUGIN=memctrlrplugin
12 DEFINES += PLUGIN=memctrlrplugin
13 DEFINES += PLUGINHEADER="\"\\\"memctrlrplugin.h"\\\"\"
13 DEFINES += PLUGINHEADER="\"\\\"memctrlrplugin.h"\\\"\"
14 DEFINES += driver_Name="\"\\\"MemControler"\\\"\"
14 DEFINES += driver_Name="\"\\\"MemControler"\\\"\"
15 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
15 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
16 DEFINES += driver_Description="\"\\\"Memory controler driver, works with ESA's LEON2 memory controler."\\\"\"
16 DEFINES += driver_Description="\"\\\"Memory controler driver, works with ESA's LEON2 memory controler."\\\"\"
17 DEFINES += driver_can_be_root=0
17 DEFINES += driver_can_be_root=0
18 DEFINES += driver_can_be_child=1
18 DEFINES += driver_can_be_child=1
19 DEFINES += driver_VID=0x04
19 DEFINES += driver_VID=0x04
20 DEFINES += driver_PID=0x0f
20 DEFINES += driver_PID=0x0f
21
21
22 #LIBS +=-llppmoncommon
22 #LIBS +=-llppmoncommon
23
23
24 INCLUDEPATH += \
24 INCLUDEPATH += \
25 $${PWD}
25 $${PWD}
26
26
27 HEADERS += \
27 HEADERS += \
28 memctrlrplugin.h \
28 memctrlrplugin.h \
29 memctrlrpluginui.h \
29 memctrlrpluginui.h \
30 memorycheck.h \
30 memorycheck.h \
31 genericmemoryspacecheck.h \
31 genericmemoryspacecheck.h
32 memctrlrpywrapper.h
33
32
34 SOURCES += \
33 SOURCES += \
35 memctrlrplugin.cpp \
34 memctrlrplugin.cpp \
36 memctrlrpluginui.cpp \
35 memctrlrpluginui.cpp \
37 memorycheck.cpp \
36 memorycheck.cpp \
38 genericmemoryspacecheck.cpp \
37 genericmemoryspacecheck.cpp
39 memctrlrpywrapper.cpp
40
38
41
39
42
40
43
41
44
42
45
43
46
44
47
45
48
46
49
47
50
48
51
49
52
50
53
51
54
52
55
53
56
54
57
55
58
56
59
57
60
58
61
59
62
60
63
61
64
62
65
63
66
64
67
65
@@ -1,182 +1,182
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22
22
23 #include "spwplugin.h"
23 #include "spwplugin.h"
24 #include "stardundeespw_usb.h"
24 #include "stardundeespw_usb.h"
25 #include "gr_esb_bridge.h"
25 #include "gr_esb_bridge.h"
26 #include <socexplorerproxy.h>
26 #include <socexplorerproxy.h>
27 #include "spwpywrapper.h"
27 #include "spwpywrapper.h"
28
28
29
29
30 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
30 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
31 {
31 {
32 Q_UNUSED(parent)
32 Q_UNUSED(parent)
33 this->bridge = NULL;
33 this->bridge = NULL;
34 this->scanDone = false;
34 this->scanDone = false;
35 this->pyObject = new spwPyWrapper(this);
35 // this->pyObject = new spwPyWrapper(this);
36 this->tcpServer = new SpwTcpPacketServer(this);
36 this->tcpServer = new SpwTcpPacketServer(this);
37 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
37 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
38 this->bridgeSelector = new QComboBox(this);
38 this->bridgeSelector = new QComboBox(this);
39 this->mainTabWidgt = new QTabWidget(this);
39 this->mainTabWidgt = new QTabWidget(this);
40 this->mainTabWidgt->addTab(this->mainGroupBox,"Bridge Configuration");
40 this->mainTabWidgt->addTab(this->mainGroupBox,"Bridge Configuration");
41 this->mainTabWidgt->addTab(this->tcpServer,"TCP Server");
41 this->mainTabWidgt->addTab(this->tcpServer,"TCP Server");
42 this->mainLayout = new QGridLayout(this->mainGroupBox);
42 this->mainLayout = new QGridLayout(this->mainGroupBox);
43 this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter);
43 this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter);
44 this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1);
44 this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1);
45 this->setWidget(this->mainTabWidgt);
45 this->setWidget(this->mainTabWidgt);
46 this->bridgeSelector->addItem("none");
46 this->bridgeSelector->addItem("none");
47 this->bridgeSelector->addItem("STAR-Dundee Spw USB Brick");
47 this->bridgeSelector->addItem("STAR-Dundee Spw USB Brick");
48 this->bridgeSelector->addItem("GR-ESB");
48 this->bridgeSelector->addItem("GR-ESB");
49 connect(this->bridgeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(bridgeSelectionChanged(QString)));
49 connect(this->bridgeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(bridgeSelectionChanged(QString)));
50 connect(((spwPyWrapper*)this->pyObject),SIGNAL(selectBridge(QString)),this,SLOT(selectBridge(QString)));
50 connect(this,SIGNAL(selectBridge(QString)),this,SLOT(selectBridge(QString)));
51 connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerConnect()),this->tcpServer,SLOT(connectServer()));
51 connect(this,SIGNAL(TCPServerConnect()),this->tcpServer,SLOT(connectServer()));
52 connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerDisconnect()),this->tcpServer,SLOT(disconnectServer()));
52 connect(this,SIGNAL(TCPServerDisconnect()),this->tcpServer,SLOT(disconnectServer()));
53 connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerSetPort(qint32)),this->tcpServer,SLOT(setServerPort(qint32)));
53 connect(this,SIGNAL(TCPServerSetPort(qint32)),this->tcpServer,SLOT(setServerPort(qint32)));
54 connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerSetIP(QString)),this->tcpServer,SLOT(setServerSetIP(QString)));
54 connect(this,SIGNAL(TCPServerSetIP(QString)),this->tcpServer,SLOT(setServerSetIP(QString)));
55 }
55 }
56
56
57
57
58 spwplugin::~spwplugin()
58 spwplugin::~spwplugin()
59 {
59 {
60
60
61 }
61 }
62
62
63
63
64
64
65 unsigned int spwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
65 unsigned int spwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address)
66 {
66 {
67 if(Connected)
67 if(Connected)
68 {
68 {
69 return bridge->Read(Value,count,address);
69 return bridge->Read(Value,count,address);
70 }
70 }
71 return 0;
71 return 0;
72 }
72 }
73
73
74 void spwplugin::bridgeSelectionChanged(const QString &text)
74 void spwplugin::bridgeSelectionChanged(const QString &text)
75 {
75 {
76 printf("test");
76 printf("test");
77 if(text=="none")
77 if(text=="none")
78 {
78 {
79 if(this->bridge!=NULL)
79 if(this->bridge!=NULL)
80 {
80 {
81 this->mainLayout->removeWidget(this->bridge->getGUI());
81 this->mainLayout->removeWidget(this->bridge->getGUI());
82 this->disconnect(this,SLOT(setConnected(bool)));
82 this->disconnect(this,SLOT(setConnected(bool)));
83 delete this->bridge;
83 delete this->bridge;
84 this->bridge= NULL;
84 this->bridge= NULL;
85 }
85 }
86 }
86 }
87 if(text=="STAR-Dundee Spw USB Brick")
87 if(text=="STAR-Dundee Spw USB Brick")
88 {
88 {
89 if(this->bridge!=NULL)
89 if(this->bridge!=NULL)
90 {
90 {
91 this->mainLayout->removeWidget(this->bridge->getGUI());
91 this->mainLayout->removeWidget(this->bridge->getGUI());
92 this->disconnect(this,SLOT(setConnected(bool)));
92 this->disconnect(this,SLOT(setConnected(bool)));
93 delete this->bridge;
93 delete this->bridge;
94 }
94 }
95 this->bridge = new stardundeeSPW_USB(this);
95 this->bridge = new stardundeeSPW_USB(this);
96 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
96 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
97 connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool)));
97 connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool)));
98 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectBrick(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectBrick(int)));
98 connect(this,SIGNAL(StarDundeeSelectBrick(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectBrick(int)));
99 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkNumber(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkNumber(int)));
99 connect(this,SIGNAL(StarDundeeSelectLinkNumber(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkNumber(int)));
100 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkSpeed(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkSpeed(int)));
100 connect(this,SIGNAL(StarDundeeSelectLinkSpeed(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkSpeed(int)));
101 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetSourceAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetSourceAddress(QString)));
101 connect(this,SIGNAL(StarDundeeSetSourceAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetSourceAddress(QString)));
102 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetDestinationAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationAddress(QString)));
102 connect(this,SIGNAL(StarDundeeSetDestinationAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationAddress(QString)));
103 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetDestinationKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationKey(QString)));
103 connect(this,SIGNAL(StarDundeeSetDestinationKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationKey(QString)));
104 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapTimeout(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapTimeout(QString)));
104 connect(this,SIGNAL(StarDundeeSetRmapTimeout(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapTimeout(QString)));
105 connect(((spwPyWrapper*)this->pyObject),SIGNAL(connectBridge()),((stardundeeSPW_USB*)bridge),SLOT(connectBridge()));
105 connect(this,SIGNAL(connectBridge()),((stardundeeSPW_USB*)bridge),SLOT(connectBridge()));
106 connect(((spwPyWrapper*)this->pyObject),SIGNAL(disconnectBridge()),((stardundeeSPW_USB*)bridge),SLOT(disconnectBridge()));
106 connect(this,SIGNAL(disconnectBridge()),((stardundeeSPW_USB*)bridge),SLOT(disconnectBridge()));
107 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeGetAvailableBrickCount()),
107 connect(this,SIGNAL(StarDundeeGetAvailableBrickCount()),
108 ((stardundeeSPW_USB*)bridge),SIGNAL(GetAvailableBrickCount()));
108 ((stardundeeSPW_USB*)bridge),SIGNAL(GetAvailableBrickCount()));
109 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeGetNbPacketsTransmittedToSpw()),
109 connect(this,SIGNAL(StarDundeeGetNbPacketsTransmittedToSpw()),
110 ((stardundeeSPW_USB*)bridge),SIGNAL(GetNbPacketsTransmittedToSpw()));
110 ((stardundeeSPW_USB*)bridge),SIGNAL(GetNbPacketsTransmittedToSpw()));
111 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeGetNbCCSDSPacketsTransmittedToSpw()),
111 connect(this,SIGNAL(StarDundeeGetNbCCSDSPacketsTransmittedToSpw()),
112 ((stardundeeSPW_USB*)bridge),SIGNAL(GetNbCCSDSPacketsTransmittedToSpw()));
112 ((stardundeeSPW_USB*)bridge),SIGNAL(GetNbCCSDSPacketsTransmittedToSpw()));
113 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeGetLinkNumber()),((stardundeeSPW_USB*)bridge),SIGNAL(GetLinkNumber()));
113 connect(this,SIGNAL(StarDundeeGetLinkNumber()),((stardundeeSPW_USB*)bridge),SIGNAL(GetLinkNumber()));
114 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetBrickAsAninterface(bool)),
114 connect(this->,SIGNAL(StarDundeeSetBrickAsAninterface(bool)),
115 ((stardundeeSPW_USB*)bridge),SIGNAL(SetBrickAsAnInterface(bool)));
115 ((stardundeeSPW_USB*)bridge),SIGNAL(SetBrickAsAnInterface(bool)));
116 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetBrickAsARouter(bool)),
116 connect(this,SIGNAL(StarDundeeSetBrickAsARouter(bool)),
117 ((stardundeeSPW_USB*)bridge),SIGNAL(SetBrickAsARouter(bool)));
117 ((stardundeeSPW_USB*)bridge),SIGNAL(SetBrickAsARouter(bool)));
118 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeStartTimecodes(bool)),
118 connect(this,SIGNAL(StarDundeeStartTimecodes(bool)),
119 ((stardundeeSPW_USB*)bridge),SIGNAL(StartSendingTimecodes(bool)));
119 ((stardundeeSPW_USB*)bridge),SIGNAL(StartSendingTimecodes(bool)));
120 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetTimecodeFrequency(double)),
120 connect(this,SIGNAL(StarDundeeSetTimecodeFrequency(double)),
121 ((stardundeeSPW_USB*)bridge),SIGNAL(SetTimecodeFrequency(double)));
121 ((stardundeeSPW_USB*)bridge),SIGNAL(SetTimecodeFrequency(double)));
122 connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSendOneTimecode(unsigned char)),
122 connect(this,SIGNAL(StarDundeeSendOneTimecode(unsigned char)),
123 ((stardundeeSPW_USB*)bridge),SIGNAL(SendOneTimecode(unsigned char)));
123 ((stardundeeSPW_USB*)bridge),SIGNAL(SendOneTimecode(unsigned char)));
124 connect(this->bridge,SIGNAL(pushPacketOverTCP(char*,int)),this->tcpServer,SLOT(pushPacket(char*,int)));
124 connect(this->bridge,SIGNAL(pushPacketOverTCP(char*,int)),this->tcpServer,SLOT(pushPacket(char*,int)));
125 connect(this->tcpServer, SIGNAL(sendSPWPacket(char*,int)), ((stardundeeSPW_USB*)bridge), SLOT(sendPacketComingFromTCPServer(char*,int)));
125 connect(this->tcpServer, SIGNAL(sendSPWPacket(char*,int)), ((stardundeeSPW_USB*)bridge), SLOT(sendPacketComingFromTCPServer(char*,int)));
126 }
126 }
127 if(text=="GR-ESB")
127 if(text=="GR-ESB")
128 {
128 {
129 if(this->bridge!=NULL)
129 if(this->bridge!=NULL)
130 {
130 {
131 this->mainLayout->removeWidget(this->bridge->getGUI());
131 this->mainLayout->removeWidget(this->bridge->getGUI());
132 this->disconnect(this,SLOT(setConnected(bool)));
132 this->disconnect(this,SLOT(setConnected(bool)));
133 delete this->bridge;
133 delete this->bridge;
134 }
134 }
135 this->bridge = new GR_ESB_bridge(this);
135 this->bridge = new GR_ESB_bridge(this);
136 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
136 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
137 connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool)));
137 connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool)));
138 }
138 }
139 }
139 }
140
140
141
141
142 void spwplugin::selectBridge(const QString &text)
142 void spwplugin::selectBridge(const QString &text)
143 {
143 {
144
144
145 if(text=="none")
145 if(text=="none")
146 {
146 {
147 this->bridgeSelector->setCurrentIndex(0);
147 this->bridgeSelector->setCurrentIndex(0);
148 }
148 }
149 if(text=="STAR-Dundee Spw USB Brick")
149 if(text=="STAR-Dundee Spw USB Brick")
150 {
150 {
151 this->bridgeSelector->setCurrentIndex(1);
151 this->bridgeSelector->setCurrentIndex(1);
152 }
152 }
153 }
153 }
154
154
155 void spwplugin::setConnected(bool connected)
155 void spwplugin::setConnected(bool connected)
156 {
156 {
157 this->bridgeSelector->setDisabled(connected);
157 this->bridgeSelector->setDisabled(connected);
158 this->Connected = connected;
158 this->Connected = connected;
159 emit activateSig(connected);
159 emit activateSig(connected);
160 if(!this->scanDone)
160 if(!this->scanDone)
161 {
161 {
162 socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN");
162 socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN");
163 this->scanDone=true;
163 this->scanDone=true;
164 }
164 }
165 }
165 }
166
166
167 unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
167 unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
168 {
168 {
169 if(Connected)
169 if(Connected)
170 {
170 {
171 return bridge->Write(Value,count,address);
171 return bridge->Write(Value,count,address);
172 }
172 }
173 return 0;
173 return 0;
174 }
174 }
175
175
176
176
177
177
178
178
179
179
180
180
181
181
182
182
@@ -1,79 +1,103
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef spwplugin_H
22 #ifndef spwplugin_H
23 #define spwplugin_H
23 #define spwplugin_H
24 #include <QMenuBar>
24 #include <QMenuBar>
25 #include <QMenu>
25 #include <QMenu>
26 #include <QAction>
26 #include <QAction>
27 #include <QLayout>
27 #include <QLayout>
28 #include <QGroupBox>
28 #include <QGroupBox>
29 #include <QComboBox>
29 #include <QComboBox>
30 #include <QLabel>
30 #include <QLabel>
31 #include <QTabWidget>
31 #include <QTabWidget>
32
32
33 #include <abstractspwbridge.h>
33 #include <abstractspwbridge.h>
34 #include <socexplorerplugin.h>
34 #include <socexplorerplugin.h>
35
35
36 #include "SpwTcpPacketServer/spwtcppacketserver.h"
36 #include "SpwTcpPacketServer/spwtcppacketserver.h"
37
37
38 // TODO switch to a class factory approach with self registration
38 // TODO switch to a class factory approach with self registration
39
39
40 class spwplugin : public socexplorerplugin
40 class spwplugin : public socexplorerplugin
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 explicit spwplugin(QWidget *parent = 0);
44 explicit spwplugin(QWidget *parent = 0);
45 ~spwplugin();
45 ~spwplugin();
46 /* You can implement the folowing function if you want to overwrite
46 /* You can implement the folowing function if you want to overwrite
47 * their default behavior
47 * their default behavior
48 */
48 */
49 /*
49 /*
50 int registermenu(QMainWindow *menuHolder);
50 int registermenu(QMainWindow *menuHolder);
51 int isConnected();
51 int isConnected();
52 int connect();
52 int connect();
53 int VID(){return driver_VID;}
53 int VID(){return driver_VID;}
54 int PID(){return driver_PID;}
54 int PID(){return driver_PID;}
55 */
55 */
56
56
57 public slots:
57 public slots:
58 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
58 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
59 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
59 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
60
60
61 void bridgeSelectionChanged( const QString & text );
61 void bridgeSelectionChanged( const QString & text );
62 void selectBridge( const QString & text );
62 void selectBridge( const QString & text );
63 void setConnected(bool connected);
63 void setConnected(bool connected);
64
64
65 signals:
65 signals:
66 void selectBridge(const QString &bridgeName);
67 bool connectBridge();
68 bool disconnectBridge();
69 void StarDundeeSelectBrick(int brickIndex);
70 void StarDundeeSelectLinkNumber(int linkIndex);
71 void StarDundeeSelectLinkSpeed(int linkSpeed);
72 void StarDundeeSetSourceAddress(const QString & destKey);
73 void StarDundeeSetDestinationAddress(const QString & address);
74 void StarDundeeSetDestinationKey(const QString & key);
75 void StarDundeeSetRmapTimeout(const QString & timeout);
76 int StarDundeeGetAvailableBrickCount();
77 unsigned int StarDundeeGetNbPacketsTransmittedToSpw( void );
78 unsigned int StarDundeeGetNbCCSDSPacketsTransmittedToSpw( void );
79 int StarDundeeGetLinkNumber();
80 void StarDundeeSetBrickAsAninterface( bool );
81 void StarDundeeSetBrickAsARouter( bool );
82 void StarDundeeSetTimecodeFrequency( double );
83 void StarDundeeStartTimecodes( bool );
84 void StarDundeeSendOneTimecode( unsigned char timecode );
85
86 void TCPServerConnect();
87 void TCPServerDisconnect();
88 void TCPServerSetPort(qint32 port);
89 void TCPServerSetIP(QString ip);
66
90
67 private:
91 private:
68 SpwTcpPacketServer* tcpServer;
92 SpwTcpPacketServer* tcpServer;
69 abstractSpwBridge* bridge;
93 abstractSpwBridge* bridge;
70 bool scanDone;
94 bool scanDone;
71 QTabWidget* mainTabWidgt;
95 QTabWidget* mainTabWidgt;
72 QGroupBox* mainGroupBox;
96 QGroupBox* mainGroupBox;
73 QComboBox* bridgeSelector;
97 QComboBox* bridgeSelector;
74 QGridLayout* mainLayout;
98 QGridLayout* mainLayout;
75
99
76 };
100 };
77
101
78 #endif // spwplugin_H
102 #endif // spwplugin_H
79
103
@@ -1,90 +1,88
1 #
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
3 #
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7 QT += network webkit
7 QT += network webkit
8 greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets
8 greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets
9
9
10 win32:CONFIG += dll
10 win32:CONFIG += dll
11 win32:CONFIG -= static
11 win32:CONFIG -= static
12 VERSION=0.5.0
12 VERSION=0.5.0
13 TARGET = spwplugin
13 TARGET = spwplugin
14 DEFINES += PLUGIN=spwplugin
14 DEFINES += PLUGIN=spwplugin
15 DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\"
15 DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\"
16 DEFINES += driver_Name="\"\\\"SpwPlugin"\\\"\"
16 DEFINES += driver_Name="\"\\\"SpwPlugin"\\\"\"
17 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org; Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\"
17 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org; Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\"
18 DEFINES += driver_Description="\"\\\"This plugin allows you to use spacewire's RMAP protocol with Stardundee USB brick v1"\\\"\"
18 DEFINES += driver_Description="\"\\\"This plugin allows you to use spacewire's RMAP protocol with Stardundee USB brick v1"\\\"\"
19 DEFINES += driver_can_be_root=1
19 DEFINES += driver_can_be_root=1
20 DEFINES += driver_can_be_child=0
20 DEFINES += driver_can_be_child=0
21 DEFINES += driver_VID=0
21 DEFINES += driver_VID=0
22 DEFINES += driver_PID=0
22 DEFINES += driver_PID=0
23
23
24 STARTDUNDEEPATH=/home/spacewire/usb/spw_usb_driver_v2.68/
24 STARTDUNDEEPATH=/home/spacewire/usb/spw_usb_driver_v2.68/
25
25
26 LIBS += $$STARTDUNDEEPATH/lib/x86_64/libSpaceWireUSBAPI.so \
26 LIBS += $$STARTDUNDEEPATH/lib/x86_64/libSpaceWireUSBAPI.so \
27 $$STARTDUNDEEPATH/lib/x86_64/libConfigLibraryUSB.so
27 $$STARTDUNDEEPATH/lib/x86_64/libConfigLibraryUSB.so
28
28
29 INCLUDEPATH += \
29 INCLUDEPATH += \
30 $${PWD} \
30 $${PWD} \
31 $$STARTDUNDEEPATH/inc \
31 $$STARTDUNDEEPATH/inc \
32 StarDundee \
32 StarDundee \
33 SpwTcpPacketServer \
33 SpwTcpPacketServer \
34 GR-ESB
34 GR-ESB
35
35
36 HEADERS += \
36 HEADERS += \
37 spwplugin.h \
37 spwplugin.h \
38 StarDundee/stardundeespw_usb.h \
38 StarDundee/stardundeespw_usb.h \
39 abstractspwbridge.h \
39 abstractspwbridge.h \
40 spw.h \
40 spw.h \
41 StarDundee/stardundeegui.h \
41 StarDundee/stardundeegui.h \
42 SpwTcpPacketServer/spwtcppacketserver.h \
42 SpwTcpPacketServer/spwtcppacketserver.h \
43 spwpywrapper.h \
44 GR-ESB/gr_esb_bridge.h \
43 GR-ESB/gr_esb_bridge.h \
45 GR-ESB/gr_esb_ui.h \
44 GR-ESB/gr_esb_ui.h \
46 SpwTcpPacketServer/incomingpacketparser.h
45 SpwTcpPacketServer/incomingpacketparser.h
47
46
48
47
49 SOURCES += \
48 SOURCES += \
50 spwplugin.cpp \
49 spwplugin.cpp \
51 StarDundee/stardundeespw_usb.cpp \
50 StarDundee/stardundeespw_usb.cpp \
52 abstractspwbridge.cpp \
51 abstractspwbridge.cpp \
53 StarDundee/stardundeegui.cpp \
52 StarDundee/stardundeegui.cpp \
54 SpwTcpPacketServer/spwtcppacketserver.cpp \
53 SpwTcpPacketServer/spwtcppacketserver.cpp \
55 spwpywrapper.cpp \
56 GR-ESB/gr_esb_bridge.cpp \
54 GR-ESB/gr_esb_bridge.cpp \
57 GR-ESB/gr_esb_ui.cpp \
55 GR-ESB/gr_esb_ui.cpp \
58 SpwTcpPacketServer/incomingpacketparser.cpp
56 SpwTcpPacketServer/incomingpacketparser.cpp
59
57
60 FORMS += \
58 FORMS += \
61 StarDundee/stardundeeGUI.ui \
59 StarDundee/stardundeeGUI.ui \
62 SpwTcpPacketServer/spwtcppacketserver.ui \
60 SpwTcpPacketServer/spwtcppacketserver.ui \
63 GR-ESB/gr_esb_ui.ui
61 GR-ESB/gr_esb_ui.ui
64
62
65 RESOURCES += \
63 RESOURCES += \
66 spwRessources.qrc
64 spwRessources.qrc
67
65
68
66
69
67
70
68
71
69
72
70
73
71
74
72
75
73
76
74
77
75
78
76
79
77
80
78
81
79
82
80
83
81
84
82
85
83
86
84
87
85
88
86
89
87
90
88
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now