##// END OF EJS Templates
Added cache enable/disable on dsu3plugin....
jeandet -
r44:0935da2bcc7f default
parent child
Show More
@@ -1,75 +1,75
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 win32:CONFIG += dll
8 win32:CONFIG += dll
9 win32:CONFIG -= static
9 win32:CONFIG -= static
10
10
11 CONFIG(debug, debug|release) {
11 #CONFIG(debug, debug|release) {
12 DEBUG_EXT = _d
12 # DEBUG_EXT = _d
13 } else {
13 #} else {
14 DEBUG_EXT =
14 # DEBUG_EXT =
15 }
15 #}
16
16
17 TARGET = ApbUartPlugin$${DEBUG_EXT}
17 TARGET = ApbUartPlugin #$${DEBUG_EXT}
18
18
19 DEFINES += PLUGIN=ApbUartPlugin
19 DEFINES += PLUGIN=ApbUartPlugin
20 DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\"
20 DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\"
21 DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\"
21 DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\"
22 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\"
22 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\"
23 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
23 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
24 DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\"
24 DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\"
25 DEFINES += driver_can_be_root=0
25 DEFINES += driver_can_be_root=0
26 DEFINES += driver_can_be_child=1
26 DEFINES += driver_can_be_child=1
27 DEFINES += driver_VID=1
27 DEFINES += driver_VID=1
28 DEFINES += driver_PID=0x0c
28 DEFINES += driver_PID=0x0c
29
29
30
30
31
31
32 INCLUDEPATH += \
32 INCLUDEPATH += \
33 $${PWD}
33 $${PWD}
34
34
35 HEADERS += \
35 HEADERS += \
36 APBUARTPLUGIN.h \
36 APBUARTPLUGIN.h \
37 apbuartterminal.h \
37 apbuartterminal.h \
38 apbuart_plugin_ui.h \
38 apbuart_plugin_ui.h \
39 uartpollingthread.h \
39 uartpollingthread.h \
40 apbuartpywrapper.h
40 apbuartpywrapper.h
41
41
42
42
43 SOURCES += \
43 SOURCES += \
44 APBUARTPLUGIN.cpp \
44 APBUARTPLUGIN.cpp \
45 apbuartterminal.cpp \
45 apbuartterminal.cpp \
46 apbuart_plugin_ui.cpp \
46 apbuart_plugin_ui.cpp \
47 uartpollingthread.cpp \
47 uartpollingthread.cpp \
48 apbuartpywrapper.cpp
48 apbuartpywrapper.cpp
49
49
50 FORMS += \
50 FORMS += \
51 apbuart_plugin_ui.ui
51 apbuart_plugin_ui.ui
52
52
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
73
73
74
74
75
75
@@ -1,70 +1,70
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 CONFIG(debug, debug|release) {
10 #CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
11 # DEBUG_EXT = _d
12 } else {
12 #} else {
13 DEBUG_EXT =
13 # DEBUG_EXT =
14 }
14 #}
15 TARGET = ahbuartplugin$${DEBUG_EXT}
15 TARGET = ahbuartplugin #$${DEBUG_EXT}
16 DEFINES += PLUGIN=ahbuartplugin
16 DEFINES += PLUGIN=ahbuartplugin
17 DEFINES += PLUGINHEADER="\"\\\"ahbuartplugin.h"\\\"\"
17 DEFINES += PLUGINHEADER="\"\\\"ahbuartplugin.h"\\\"\"
18 DEFINES += driver_Name="\"\\\"AHBUARTplugin"\\\"\"
18 DEFINES += driver_Name="\"\\\"AHBUARTplugin"\\\"\"
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_Version="\"\\\"1.3.2"\\\"\"
20 DEFINES += driver_Version="\"\\\"1.3.2"\\\"\"
21 DEFINES += driver_Description="\"\\\"Gaisler's AHBUART driver, gives master access to AHB bus."\\\"\"
21 DEFINES += driver_Description="\"\\\"Gaisler's AHBUART driver, gives master access to AHB bus."\\\"\"
22 DEFINES += driver_can_be_root=1
22 DEFINES += driver_can_be_root=1
23 DEFINES += driver_can_be_child=0
23 DEFINES += driver_can_be_child=0
24 DEFINES += driver_VID=0
24 DEFINES += driver_VID=0
25 DEFINES += driver_PID=0
25 DEFINES += driver_PID=0
26
26
27
27
28
28
29
29
30 INCLUDEPATH += \
30 INCLUDEPATH += \
31 $${PWD}
31 $${PWD}
32
32
33
33
34 HEADERS += \
34 HEADERS += \
35 ahbuartplugin.h \
35 ahbuartplugin.h \
36 ahbuartpluginui.h \
36 ahbuartpluginui.h \
37 ahbuartpywrapper.h \
37 ahbuartpywrapper.h \
38 ahbuartpywrapper.h
38 ahbuartpywrapper.h
39
39
40
40
41
41
42 SOURCES += \
42 SOURCES += \
43 ahbuartplugin.cpp \
43 ahbuartplugin.cpp \
44 ahbuartpluginui.cpp \
44 ahbuartpluginui.cpp \
45 ahbuartpywrapper.cpp
45 ahbuartpywrapper.cpp
46
46
47 FORMS += \
47 FORMS += \
48 ahbuartpluginui.ui
48 ahbuartpluginui.ui
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
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
@@ -1,68 +1,68
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 CONFIG(debug, debug|release) {
9 #CONFIG(debug, debug|release) {
10 DEBUG_EXT = _d
10 # DEBUG_EXT = _d
11 } else {
11 #} else {
12 DEBUG_EXT =
12 # DEBUG_EXT =
13 }
13 #}
14 TARGET = ambaplugin$${DEBUG_EXT}
14 TARGET = ambaplugin #$${DEBUG_EXT}
15 DEFINES += PLUGIN=ambaplugin
15 DEFINES += PLUGIN=ambaplugin
16 DEFINES += PLUGINHEADER="\"\\\"ambaplugin.h"\\\"\"
16 DEFINES += PLUGINHEADER="\"\\\"ambaplugin.h"\\\"\"
17 DEFINES += driver_Name="\"\\\"AMBA_PLUGIN"\\\"\"
17 DEFINES += driver_Name="\"\\\"AMBA_PLUGIN"\\\"\"
18 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
18 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
19 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
19 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
20 DEFINES += driver_Description="\"\\\"This driver handles the Gaisler AMBA plugn' play system."\\\"\"
20 DEFINES += driver_Description="\"\\\"This driver handles the Gaisler AMBA plugn' play system."\\\"\"
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=0
23 DEFINES += driver_VID=0
24 DEFINES += driver_PID=0
24 DEFINES += driver_PID=0
25
25
26 INCLUDEPATH += \
26 INCLUDEPATH += \
27 $${PWD}
27 $${PWD}
28
28
29 HEADERS += \
29 HEADERS += \
30 ambaplugin.h \
30 ambaplugin.h \
31 AHB/ahbpluginui.h \
31 AHB/ahbpluginui.h \
32 AHB/ahbdevicelist.h \
32 AHB/ahbdevicelist.h \
33 APB/apbpluginui.h \
33 APB/apbpluginui.h \
34 APB/apbdevicelist.h \
34 APB/apbdevicelist.h \
35 ambapluginui.h
35 ambapluginui.h
36
36
37
37
38 SOURCES += \
38 SOURCES += \
39 ambaplugin.cpp \
39 ambaplugin.cpp \
40 AHB/ahbpluginui.cpp \
40 AHB/ahbpluginui.cpp \
41 AHB/ahbdevicelist.cpp \
41 AHB/ahbdevicelist.cpp \
42 APB/apbpluginui.cpp \
42 APB/apbpluginui.cpp \
43 APB/apbdevicelist.cpp \
43 APB/apbdevicelist.cpp \
44 ambapluginui.cpp
44 ambapluginui.cpp
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
63
64
64
65
65
66
66
67
67
68
68
@@ -1,255 +1,311
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
29 struct acceptedMemctrlr_str
30 {
31 int vid;
32 int pid;
33 const char* name;
34 };
35
36 const struct acceptedMemctrlr_str acceptedMemctrlr[]=
37 {
38 {0x01,0x04,"MCTRL"},
39 {0x01,0x51,"FTSRCTRL"},
40 {0x20,0x01,"SRCTRLE_0WS" },
41 {0x20,0x02,"SRCTRLE_1WS" }
42 };
43
44 #define acceptedMemctrlrCnt sizeof acceptedMemctrlr
45
28 dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false)
46 dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false)
29 {
47 {
30 this->UI = new dsu3pluginui();
48 this->UI = new dsu3pluginui();
31 this->setWidget((QWidget*)this->UI);
49 this->setWidget((QWidget*)this->UI);
32 this->elfparserInst = new elfparser();
50 this->elfparserInst = new elfparser();
33 this->pyObject = new dsu3pluginPywrapper(this);
51 this->pyObject = new dsu3pluginPywrapper(this);
34 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)));
35 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
53 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
36 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
54 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
37 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
55 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
38 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
56 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheEnable()),this,SLOT(cacheEnable()));
39 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
57 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheDisable()),this,SLOT(cacheDisable()));
40 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
58 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(setCacheEnable(bool)),this,SLOT(setCacheEnable(bool)));
41 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
59
42 this->running = false;
60 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
61 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
62 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
63 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
64 this->running = false;
43 }
65 }
44
66
45
67
46 dsu3plugin::~dsu3plugin()
68 dsu3plugin::~dsu3plugin()
47 {
69 {
48
70
49 }
71 }
50
72
51
73
52 void dsu3plugin::openFile()
74 void dsu3plugin::openFile()
53 {
75 {
54 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 (*)"));
55 if(filename!="")
77 if(filename!="")
56 {
78 {
57 this->openFile(filename);
79 this->openFile(filename);
58 }
80 }
59 }
81 }
60
82
61 void dsu3plugin::openFile(QString fileName)
83 void dsu3plugin::openFile(QString fileName)
62 {
84 {
63 this->elfparserInst->setFilename(fileName);
85 this->elfparserInst->setFilename(fileName);
64 emit this->updateInfo(this->elfparserInst);
86 emit this->updateInfo(this->elfparserInst);
65 }
87 }
66
88
67 bool dsu3plugin::configureTarget()
89 bool dsu3plugin::configureTarget()
68 {
90 {
69 if(parent==NULL)
91 if(parent==NULL)
70 return false;
92 return false;
71 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
93 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
72 if(DSUBASEADDRESS == (unsigned int)-1)
94 if(DSUBASEADDRESS == (unsigned int)-1)
73 DSUBASEADDRESS = 0x90000000;
95 DSUBASEADDRESS = 0x90000000;
74 unsigned int MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x04 , 0x00F,0);
96 unsigned int MCTRLBASEADDRESS =-1;
75 if(MCTRLBASEADDRESS == (unsigned int)-1)
97 for(int i=0; i<acceptedMemctrlrCnt;i++)
76 {
98 {
77 SocExplorerEngine::message(this,"Can't find MemCtrlr",1);
99 MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,acceptedMemctrlr[i].vid , acceptedMemctrlr[i].pid,0);
78 MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x051,0);
100 if(MCTRLBASEADDRESS != (unsigned int)-1) break;
79 if(MCTRLBASEADDRESS == (unsigned int)-1)
101 }
80 {
102 if(MCTRLBASEADDRESS == (unsigned int)-1)
81 SocExplorerEngine::message(this,"Can't find FTMemCtrlr",1);
103 {
82 return false;
104 //SocExplorerEngine::message(this,"Can't find FTMemCtrlr",1);
83 }
105 return false;
84 }
106 }
85
107
86 //Force a debug break
108
87 WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS);
109 //Force a debug break
88 WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20);
110 WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS);
89 //Clear time tag counter
111 WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20);
90 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8);
112 //Clear time tag counter
113 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8);
91
114
92 //Clear ASR registers
115 //Clear ASR registers
93 WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040);
116 WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040);
94 WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024);
117 WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024);
95 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
118 WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
96 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48);
119 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48);
97 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
120 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C);
98 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
121 WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040);
99
122
100
123
101
124
102 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
125 WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS);
103
126
104
127
105 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
128 WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060);
106 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
129 WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24);
130
131 unsigned int buff=0;
132 // for(int i=0;i<1567;i++)
133 // {
134 // parent->Write(&buff,(unsigned int)1,DSUBASEADDRESS+0x300000+(4*i));
135 // }
136 memSet(DSUBASEADDRESS+0x300000,0,1567);
137 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
138 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);
139 WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS);
107
140
108 unsigned int buff=0;
141 //Disable interrupts
109 // for(int i=0;i<1567;i++)
142 unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0);
110 // {
143 if(APBIRQCTRLRBASEADD == (unsigned int)-1)
111 // parent->Write(&buff,(unsigned int)1,DSUBASEADDRESS+0x300000+(4*i));
144 return false;
112 // }
145 WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040);
113 memSet(DSUBASEADDRESS+0x300000,0,1567);
146 WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080);
114 WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000);
147 WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD);
115 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);
148
116 WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS);
149 //Set up timer
150 unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0);
151 if(APBTIMERBASEADD == (unsigned int)-1)
152 return false;
153 WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014);
154 WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04);
155 WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018);
156 return true;
157 }
117
158
118 //Disable interrupts
159 bool dsu3plugin::cacheDisable()
119 unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0);
160 {
120 if(APBIRQCTRLRBASEADD == (unsigned int)-1)
161 return setCacheEnable(false);
121 return false;
162 }
122 WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040);
163
123 WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080);
164 bool dsu3plugin::cacheEnable()
124 WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD);
165 {
166 return setCacheEnable(true);
167 }
125
168
126 //Set up timer
169 bool dsu3plugin::setCacheEnable(bool enabled)
127 unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0);
170 {
128 if(APBTIMERBASEADD == (unsigned int)-1)
171 if(parent==NULL)
129 return false;
172 return false;
130 WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014);
173 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
131 WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04);
174 if(DSUBASEADDRESS == (unsigned int)-1)
132 WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018);
175 DSUBASEADDRESS = 0x90000000;
133 return true;
176 WriteRegs(uIntlist()<<2,DSUBASEADDRESS+0x400024);
177 if(enabled)
178 {
179 WriteRegs(uIntlist()<<0x0001000F,DSUBASEADDRESS+0x700000);
180 //flushes cache.
181 WriteRegs(uIntlist()<<0x0061000F,DSUBASEADDRESS+0x700000);
182 }
183 else
184 {
185 WriteRegs(uIntlist()<<0x00000000,DSUBASEADDRESS+0x700000);
186 WriteRegs(uIntlist()<<0x00600000,DSUBASEADDRESS+0x700000);
187 }
188 return true;
134 }
189 }
135
190
136 bool dsu3plugin::flashTarget()
191 bool dsu3plugin::flashTarget()
137 {
192 {
138 configureTarget();
193 stop();
139
194 cacheDisable();
140 /*Write .text*/
195 configureTarget();
141 this->writeSection(".text");
196 /*Write .text*/
142 /*Write .data*/
197 this->writeSection(".text");
143 this->writeSection(".data");
198 /*Write .data*/
144 return true;
199 this->writeSection(".data");
200 return true;
145 }
201 }
146
202
147 void dsu3plugin::run()
203 void dsu3plugin::run()
148 {
204 {
149 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
205 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
150 if(DSUBASEADDRESS == (unsigned int)-1)
206 if(DSUBASEADDRESS == (unsigned int)-1)
151 DSUBASEADDRESS = 0x90000000;
207 DSUBASEADDRESS = 0x90000000;
152 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
208 WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020);
153 this->running = true;
209 this->running = true;
154 this->UI->setRunning(true);
210 this->UI->setRunning(true);
155 }
211 }
156
212
157 void dsu3plugin::stop()
213 void dsu3plugin::stop()
158 {
214 {
159 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
215 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
160 if(DSUBASEADDRESS == (unsigned int)-1)
216 if(DSUBASEADDRESS == (unsigned int)-1)
161 DSUBASEADDRESS = 0x90000000;
217 DSUBASEADDRESS = 0x90000000;
162 WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020);
218 WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020);
163 this->running = false;
219 this->running = false;
164 this->UI->setRunning(false);
220 this->UI->setRunning(false);
165 }
221 }
166
222
167 void dsu3plugin::toggleRun()
223 void dsu3plugin::toggleRun()
168 {
224 {
169 if(this->running)
225 if(this->running)
170 this->stop();
226 this->stop();
171 else
227 else
172 this->run();
228 this->run();
173 }
229 }
174
230
175 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
231 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
176 {
232 {
177 unsigned int* buff;
233 unsigned int* buff;
178 buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int));
234 buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int));
179 for(int i=0;i<Values.count();i++)
235 for(int i=0;i<Values.count();i++)
180 {
236 {
181 buff[i]=Values.at(i);
237 buff[i]=Values.at(i);
182 }
238 }
183 parent->Write(buff,(unsigned int)Values.count(),address);
239 parent->Write(buff,(unsigned int)Values.count(),address);
184 free(buff);
240 free(buff);
185 }
241 }
186
242
187 void dsu3plugin::writeSection(int index)
243 void dsu3plugin::writeSection(int index)
188 {
244 {
189 char* buffch=NULL;
245 char* buffch=NULL;
190 unsigned int* buff;
246 unsigned int* buff;
191 int size = this->elfparserInst->getSectionDatasz(index);
247 int size = this->elfparserInst->getSectionDatasz(index);
192 int sizeInt = size/4;
248 int sizeInt = size/4;
193 if(parent==NULL)
249 if(parent==NULL)
194 return;
250 return;
195 this->elfparserInst->getSectionData(index,&buffch);
251 this->elfparserInst->getSectionData(index,&buffch);
196 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
252 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
197 for(int i=0;i<sizeInt;i++)
253 for(int i=0;i<sizeInt;i++)
198 {
254 {
199 buff[i] = 0x0FF & ((unsigned int)buffch[4*i]);
255 buff[i] = 0x0FF & ((unsigned int)buffch[4*i]);
200 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1]));
256 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1]));
201 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2]));
257 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2]));
202 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3]));
258 buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3]));
203 }
259 }
204 if(size%4)
260 if(size%4)
205 {
261 {
206 buff[sizeInt]=0;
262 buff[sizeInt]=0;
207 for(int i=(size%4);i>0;i--)
263 for(int i=(size%4);i>0;i--)
208 {
264 {
209 buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i]));
265 buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i]));
210 }
266 }
211 sizeInt++;
267 sizeInt++;
212 }
268 }
213 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index));
269 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index));
214 free(buff);
270 free(buff);
215 }
271 }
216
272
217 void dsu3plugin::writeSection(const QString &name)
273 void dsu3plugin::writeSection(const QString &name)
218 {
274 {
219 for(int i=0;i<this->elfparserInst->getSectioncount();i++)
275 for(int i=0;i<this->elfparserInst->getSectioncount();i++)
220 {
276 {
221 if(!this->elfparserInst->getSectionName(i).compare(name))
277 if(!this->elfparserInst->getSectionName(i).compare(name))
222 {
278 {
223 printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i));
279 printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i));
224 writeSection(i);
280 writeSection(i);
225 }
281 }
226 }
282 }
227 }
283 }
228
284
229
285
230 unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
286 unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address)
231 {
287 {
232 if(parent!=NULL)
288 if(parent!=NULL)
233 return parent->Write(Value,count,address);
289 return parent->Write(Value,count,address);
234 return 0;
290 return 0;
235 }
291 }
236
292
237 bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count)
293 bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count)
238 {
294 {
239 unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int));
295 unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int));
240 if(buffer!=NULL)
296 if(buffer!=NULL)
241 {
297 {
242 memset((void*)buffer,value,count*sizeof(unsigned int));
298 memset((void*)buffer,value,count*sizeof(unsigned int));
243 parent->Write(buffer,count,address);
299 parent->Write(buffer,count,address);
244 free(buffer );
300 free(buffer );
245 return true;
301 return true;
246 }
302 }
247 return false;
303 return false;
248 }
304 }
249
305
250 unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address)
306 unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address)
251 {
307 {
252 if(parent!=NULL)
308 if(parent!=NULL)
253 return parent->Read(Value,count,address);
309 return parent->Read(Value,count,address);
254 return 0;
310 return 0;
255 }
311 }
@@ -1,64 +1,67
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 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();
50 bool cacheEnable();
51 bool setCacheEnable(bool enabled);
49 bool flashTarget();
52 bool flashTarget();
50 void run();
53 void run();
51 void stop();
54 void stop();
52 void toggleRun();
55 void toggleRun();
53 signals:
56 signals:
54 void updateInfo(elfparser* parser);
57 void updateInfo(elfparser* parser);
55 private:
58 private:
56 void WriteRegs(uIntlist Values, unsigned int address);
59 void WriteRegs(uIntlist Values, unsigned int address);
57 void writeSection(int index);
60 void writeSection(int index);
58 void writeSection(const QString& name);
61 void writeSection(const QString& name);
59 dsu3pluginui* UI;
62 dsu3pluginui* UI;
60 elfparser* elfparserInst;
63 elfparser* elfparserInst;
61 bool running;
64 bool running;
62 };
65 };
63
66
64 #endif // DSU3PLUGIN_H
67 #endif // DSU3PLUGIN_H
@@ -1,75 +1,75
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 CONFIG(debug, debug|release) {
10 #CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
11 # DEBUG_EXT = _d
12 } else {
12 #} else {
13 DEBUG_EXT =
13 # DEBUG_EXT =
14 }
14 #}
15
15
16 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
16 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
17 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
17 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
18
18
19
19
20 TARGET = dsu3plugin$${DEBUG_EXT}
20 TARGET = dsu3plugin #$${DEBUG_EXT}
21
21
22 DEFINES += PLUGIN=dsu3plugin
22 DEFINES += PLUGIN=dsu3plugin
23 DEFINES += PLUGINHEADER="\"\\\"dsu3plugin.h"\\\"\"
23 DEFINES += PLUGINHEADER="\"\\\"dsu3plugin.h"\\\"\"
24 DEFINES += driver_Name="\"\\\"dsu3plugin"\\\"\"
24 DEFINES += driver_Name="\"\\\"dsu3plugin"\\\"\"
25 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
25 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
26 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
26 DEFINES += driver_Version="\"\\\"0.0.1"\\\"\"
27 DEFINES += driver_Description="\"\\\"DSU driver, works with GAISLER's DSU3 unit."\\\"\"
27 DEFINES += driver_Description="\"\\\"DSU driver, works with GAISLER's DSU3 unit."\\\"\"
28 DEFINES += driver_can_be_root=0
28 DEFINES += driver_can_be_root=0
29 DEFINES += driver_can_be_child=1
29 DEFINES += driver_can_be_child=1
30 DEFINES += driver_VID=0x00
30 DEFINES += driver_VID=0x00
31 DEFINES += driver_PID=0x00
31 DEFINES += driver_PID=0x00
32
32
33
33
34 INCLUDEPATH += \
34 INCLUDEPATH += \
35 $${PWD}
35 $${PWD}
36
36
37
37
38
38
39 HEADERS += \
39 HEADERS += \
40 dsu3plugin.h \
40 dsu3plugin.h \
41 dsu3pluginui.h \
41 dsu3pluginui.h \
42 dsu3pluginpywrapper.h
42 dsu3pluginpywrapper.h
43
43
44 SOURCES += \
44 SOURCES += \
45 dsu3plugin.cpp \
45 dsu3plugin.cpp \
46 dsu3pluginui.cpp \
46 dsu3pluginui.cpp \
47 dsu3pluginpywrapper.cpp
47 dsu3pluginpywrapper.cpp
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
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
73
73
74
74
75
75
@@ -1,20 +1,23
1 #ifndef DSU3PLUGINPYWRAPPER_H
1 #ifndef DSU3PLUGINPYWRAPPER_H
2 #define DSU3PLUGINPYWRAPPER_H
2 #define DSU3PLUGINPYWRAPPER_H
3 #include <genericPySysdriver.h>
3 #include <genericPySysdriver.h>
4
4
5 class dsu3pluginPywrapper : public genericPySysdriver
5 class dsu3pluginPywrapper : public genericPySysdriver
6 {
6 {
7 Q_OBJECT
7 Q_OBJECT
8 public:
8 public:
9 explicit dsu3pluginPywrapper(socexplorerplugin *parent = 0);
9 explicit dsu3pluginPywrapper(socexplorerplugin *parent = 0);
10
10
11 signals:
11 signals:
12 bool openFile(QString fileName);
12 bool openFile(QString fileName);
13 bool loadFile();
13 bool loadFile();
14 bool run();
14 bool run();
15 bool stop();
15 bool stop();
16 bool cacheDisable();
17 bool cacheEnable();
18 bool setCacheEnable(bool enabled);
16 public slots:
19 public slots:
17
20
18 };
21 };
19
22
20 #endif // DSU3PLUGINPYWRAPPER_H
23 #endif // DSU3PLUGINPYWRAPPER_H
@@ -1,53 +1,53
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 CONFIG(debug, debug|release) {
10 #CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
11 # DEBUG_EXT = _d
12 } else {
12 #} else {
13 DEBUG_EXT =
13 # DEBUG_EXT =
14 }
14 #}
15 TARGET = genericrwplugin$${DEBUG_EXT}
15 TARGET = genericrwplugin #$${DEBUG_EXT}
16 DEFINES += PLUGIN=genericrwplugin
16 DEFINES += PLUGIN=genericrwplugin
17 DEFINES += PLUGINHEADER="\"\\\"genericrwplugin.h"\\\"\"
17 DEFINES += PLUGINHEADER="\"\\\"genericrwplugin.h"\\\"\"
18 DEFINES += driver_Name="\"\\\"GenericRWplugin"\\\"\"
18 DEFINES += driver_Name="\"\\\"GenericRWplugin"\\\"\"
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_Version="\"\\\"1.1.0"\\\"\"
20 DEFINES += driver_Version="\"\\\"1.1.0"\\\"\"
21 DEFINES += driver_Description="\"\\\"Generic plugin, gives you R/W access to any memory area."\\\"\"
21 DEFINES += driver_Description="\"\\\"Generic plugin, gives you R/W access to any memory area."\\\"\"
22 DEFINES += driver_can_be_root=0
22 DEFINES += driver_can_be_root=0
23 DEFINES += driver_can_be_child=1
23 DEFINES += driver_can_be_child=1
24 DEFINES += driver_VID=0
24 DEFINES += driver_VID=0
25 DEFINES += driver_PID=0
25 DEFINES += driver_PID=0
26
26
27
27
28 INCLUDEPATH += \
28 INCLUDEPATH += \
29 $${PWD}
29 $${PWD}
30
30
31 #LIBS +=-llppmoncommon$${DEBUG_EXT}
31 #LIBS +=-llppmoncommon$${DEBUG_EXT}
32
32
33 HEADERS += \
33 HEADERS += \
34 genericrwplugin.h \
34 genericrwplugin.h \
35 genericrwpluginui.h \
35 genericrwpluginui.h \
36 memeditor.h \
36 memeditor.h \
37 genericrwpluginpywrapper.h
37 genericrwpluginpywrapper.h
38
38
39 SOURCES += \
39 SOURCES += \
40 genericrwplugin.cpp \
40 genericrwplugin.cpp \
41 genericrwpluginui.cpp \
41 genericrwpluginui.cpp \
42 memeditor.cpp \
42 memeditor.cpp \
43 genericrwpluginpywrapper.cpp
43 genericrwpluginpywrapper.cpp
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
53
@@ -1,58 +1,113
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "memchecker.h"
22 #include "memchecker.h"
23
23
24 memchecker::memchecker(socexplorerplugin* plugin)
24 memchecker::memchecker(socexplorerplugin* plugin)
25 {
25 {
26 this->plugin = plugin;
26 this->plugin = plugin;
27 }
27 }
28
28
29 QString memchecker::checkmemory(unsigned int address, unsigned int size, bool *success)
29 QString memchecker::checkmemory(unsigned int address, unsigned int size, bool *success)
30 {
30 {
31 *success = true;
31 *success = true;
32 QString repport;
32 QString repport;
33 unsigned int* dataLocal = (unsigned int*)malloc(size);
33 unsigned int* dataLocal = (unsigned int*)malloc(size);
34 unsigned int* dataOnBoard = (unsigned int*)malloc(size);
34 unsigned int* dataOnBoard = (unsigned int*)malloc(size);
35 for(int i=0;(unsigned int)i<(size>>2);i++)
35 for(int i=0;(unsigned int)i<(size>>2);i++)
36 {
36 {
37 dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
37 dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
38 }
38 }
39 plugin->Write(dataLocal,size>>2,address);
39 plugin->Write(dataLocal,size>>2,address);
40 plugin->Read(dataOnBoard,size>>2,address);
40 plugin->Read(dataOnBoard,size>>2,address);
41 for(int i=0;(unsigned int)i<(size>>2);i++)
41 for(int i=0;(unsigned int)i<(size>>2);i++)
42 {
42 {
43 if(dataLocal[i]!=dataOnBoard[i])
43 if(dataLocal[i]!=dataOnBoard[i])
44 *success=false;
44 *success=false;
45 }
45 }
46 free(dataLocal);
46 free(dataLocal);
47 free(dataOnBoard);
47 free(dataOnBoard);
48 return repport;
48 return repport;
49 }
49 }
50
50
51 QString memchecker::checkdatabits(unsigned int address,unsigned int size,bool* success)
51 QString memchecker::checkdatabits(unsigned int address,unsigned int size,bool* success)
52 {
52 {
53 *success = true;
53 *success = true;
54 QString repport;
54 QString repport;
55 return repport;
55 return repport;
56 }
57
58
59 unsigned int p_pow2(unsigned int v)
60 {
61 static const char LogTable256[256] =
62 {
63 #define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n
64 -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
65 LT(4), LT(5), LT(5), LT(6), LT(6), LT(6), LT(6),
66 LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7)
67 };
68
69 unsigned int r; // r will be lg(v)
70 register unsigned int t, tt; // temporaries
71
72 if (tt = v >> 16)
73 {
74 r = (t = tt >> 8) ? 24 + LogTable256[t] : 16 + LogTable256[tt];
75 }
76 else
77 {
78 r = (t = v >> 8) ? 8 + LogTable256[t] : LogTable256[v];
79 }
80 return r;
56 }
81 }
57
82
58
83
84 unsigned int memchecker::measureMemSize(unsigned int address, unsigned int maxSize)
85 {
86 unsigned int curVal=1,testAddress=address;
87 unsigned int size=0;
88 this->plugin->Write(&curVal,1,testAddress);
89 this->plugin->Read(&curVal,1,testAddress);
90 if(curVal!=1)
91 return size;
92 unsigned int max= p_pow2((0xFFFFFFFFFFFFFFFF - address))+1;
93 register unsigned int maxSizeLg=p_pow2(maxSize)-1;
94 if(max>maxSizeLg)
95 max=maxSizeLg;
96 if(max>32)max=32;
97 for(size=2;size<max;size++) //check each address bit
98 {
99 testAddress = (unsigned int)(address+(1<<size));
100 curVal = (unsigned int)(1<<size);
101 this->plugin->Write(&curVal,1,testAddress);
102 this->plugin->Read(&curVal,1,testAddress);
103 if((unsigned int)curVal!=(unsigned int)(1<<size))
104 return (1<<(size));
105 this->plugin->Read(&curVal,1,address);
106 if((curVal==(unsigned int)(1<<size)) && (size!=0))
107 return (1<<(size));
108 }
109 return (1<<(size+1));
110 }
111
112
113
@@ -1,38 +1,39
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef MEMCHECKER_H
22 #ifndef MEMCHECKER_H
23 #define MEMCHECKER_H
23 #define MEMCHECKER_H
24
24
25 #include <socexplorerplugin.h>
25 #include <socexplorerplugin.h>
26
26
27 class memchecker
27 class memchecker
28 {
28 {
29 public:
29 public:
30 memchecker(socexplorerplugin* plugin);
30 memchecker(socexplorerplugin* plugin);
31 QString checkmemory(unsigned int address,unsigned int size,bool* success);
31 QString checkmemory(unsigned int address,unsigned int size,bool* success);
32 QString checkdatabits(unsigned int address,unsigned int size,bool* success);
32 QString checkdatabits(unsigned int address,unsigned int size,bool* success);
33
33
34 unsigned int measureMemSize(unsigned int address,unsigned int maxSize=0xFFFFFFFF);
34 private:
35 private:
35 socexplorerplugin* plugin;
36 socexplorerplugin* plugin;
36 };
37 };
37
38
38 #endif // MEMCHECKER_H
39 #endif // MEMCHECKER_H
@@ -1,52 +1,69
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "memcheckplugin.h"
22 #include "memcheckplugin.h"
23
23
24 memcheckplugin::memcheckplugin(QWidget *parent):socexplorerplugin(parent,true)
24 memcheckplugin::memcheckplugin(QWidget *parent):socexplorerplugin(parent,true)
25 {
25 {
26 this->UI = new memcheckplugin_ui();
26 this->UI = new memcheckplugin_ui();
27 this->setWidget(this->UI);
27 this->setWidget(this->UI);
28 this->checker = new memchecker(this);
28 this->checker = new memchecker(this);
29 QObject::connect(this->UI,SIGNAL(checkdatabits(uint,uint)),this,SLOT(checkdatabits(uint,uint)));
29 QObject::connect(this->UI,SIGNAL(checkdatabits(uint,uint)),this,SLOT(checkdatabits(uint,uint)));
30 QObject::connect(this->UI,SIGNAL(checkmemory(uint,uint)),this,SLOT(checkmemory(uint,uint)));
30 QObject::connect(this->UI,SIGNAL(checkmemory(uint,uint)),this,SLOT(checkmemory(uint,uint)));
31 QObject::connect(this->UI,SIGNAL(checkmemorySize(uint,uint)),this,SLOT(checkmemorySize(uint,uint)));
31 }
32 }
32
33
33 memcheckplugin::~memcheckplugin()
34 memcheckplugin::~memcheckplugin()
34 {}
35 {}
35
36
36
37
37 void memcheckplugin::checkmemory(unsigned int address, unsigned int size)
38 void memcheckplugin::checkmemory(unsigned int address, unsigned int size)
38 {
39 {
39 bool success;
40 bool success;
40 QString repport=this->checker->checkmemory(address,size,&success);
41 QString repport=this->checker->checkmemory(address,size,&success);
41 this->UI->setResult(success,repport);
42 this->UI->setResult(success,repport);
42
43
43 }
44 }
44
45
46 void memcheckplugin::checkmemorySize(unsigned int address, unsigned int size)
47 {
48 bool success=true;
49 unsigned int _size = this->checker->measureMemSize(address,size);
50 int prefix=0;
51 QStringList list;
52 list <<"B" << "KB" << "MB" << "GB";
53 while (_size>=(unsigned int)1024)
54 {
55 _size/=1024;
56 prefix++;
57 }
58 QString repport=QString::number(_size)+list.at(prefix);
59 this->UI->setResult(success,repport);
60 }
61
45 void memcheckplugin::checkdatabits(unsigned int address, unsigned int size)
62 void memcheckplugin::checkdatabits(unsigned int address, unsigned int size)
46 {
63 {
47 bool success;
64 bool success;
48 QString repport=this->checker->checkdatabits(address,size,&success);
65 QString repport=this->checker->checkdatabits(address,size,&success);
49 this->UI->setResult(success,repport);
66 this->UI->setResult(success,repport);
50 }
67 }
51
68
52
69
@@ -1,70 +1,71
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef MEMCTRLRPLUGIN_H
22 #ifndef MEMCTRLRPLUGIN_H
23 /*------------------------------------------------------------------------------
23 /*------------------------------------------------------------------------------
24 -- This file is a part of the SocExplorer Software
24 -- This file is a part of the SocExplorer Software
25 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
25 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
26 --
26 --
27 -- This program is free software; you can redistribute it and/or modify
27 -- This program is free software; you can redistribute it and/or modify
28 -- it under the terms of the GNU General Public License as published by
28 -- it under the terms of the GNU General Public License as published by
29 -- the Free Software Foundation; either version 3 of the License, or
29 -- the Free Software Foundation; either version 3 of the License, or
30 -- (at your option) any later version.
30 -- (at your option) any later version.
31 --
31 --
32 -- This program is distributed in the hope that it will be useful,
32 -- This program is distributed in the hope that it will be useful,
33 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
33 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
34 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 -- GNU General Public License for more details.
35 -- GNU General Public License for more details.
36 --
36 --
37 -- You should have received a copy of the GNU General Public License
37 -- You should have received a copy of the GNU General Public License
38 -- along with this program; if not, write to the Free Software
38 -- along with this program; if not, write to the Free Software
39 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 -------------------------------------------------------------------------------*/
40 -------------------------------------------------------------------------------*/
41 /*-- Author : Alexis Jeandet
41 /*-- Author : Alexis Jeandet
42 -- Mail : alexis.jeandet@lpp.polytechnique.fr
42 -- Mail : alexis.jeandet@lpp.polytechnique.fr
43 ----------------------------------------------------------------------------*/
43 ----------------------------------------------------------------------------*/
44 #define MEMCTRLRPLUGIN_H
44 #define MEMCTRLRPLUGIN_H
45 #include "memcheckplugin_ui.h"
45 #include "memcheckplugin_ui.h"
46 #include <QMenuBar>
46 #include <QMenuBar>
47 #include <QMenu>
47 #include <QMenu>
48 #include <QAction>
48 #include <QAction>
49 #include <QMainWindow>
49 #include <QMainWindow>
50 #include <socexplorerplugin.h>
50 #include <socexplorerplugin.h>
51 #include <memchecker.h>
51 #include <memchecker.h>
52 #include <socexplorerplugin.h>
52 #include <socexplorerplugin.h>
53
53
54 class memcheckplugin : public socexplorerplugin
54 class memcheckplugin : public socexplorerplugin
55 {
55 {
56 Q_OBJECT
56 Q_OBJECT
57 public:
57 public:
58 explicit memcheckplugin(QWidget *parent = 0);
58 explicit memcheckplugin(QWidget *parent = 0);
59 ~memcheckplugin();
59 ~memcheckplugin();
60 public slots:
60 public slots:
61 void checkmemory(unsigned int address,unsigned int size);
61 void checkmemory(unsigned int address,unsigned int size);
62 void checkmemorySize(unsigned int address,unsigned int size);
62 void checkdatabits(unsigned int address,unsigned int size);
63 void checkdatabits(unsigned int address,unsigned int size);
63 signals:
64 signals:
64
65
65 private:
66 private:
66 memcheckplugin_ui* UI;
67 memcheckplugin_ui* UI;
67 memchecker* checker;
68 memchecker* checker;
68 };
69 };
69
70
70 #endif // MEMCTRLRPLUGIN_H
71 #endif // MEMCTRLRPLUGIN_H
@@ -1,71 +1,72
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 CONFIG(debug, debug|release) {
10 #CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
11 # DEBUG_EXT = _d
12 } else {
12 #} else {
13 DEBUG_EXT =
13 # DEBUG_EXT =
14 }
14 #}
15
15
16 TARGET = memcheckplugin$${DEBUG_EXT}
16
17 TARGET = memcheckplugin #$${DEBUG_EXT}
17 DEFINES += PLUGIN=memcheckplugin
18 DEFINES += PLUGIN=memcheckplugin
18 DEFINES += PLUGINHEADER="\"\\\"memcheckplugin.h"\\\"\"
19 DEFINES += PLUGINHEADER="\"\\\"memcheckplugin.h"\\\"\"
19 DEFINES += driver_Name="\"\\\"MemChecker"\\\"\"
20 DEFINES += driver_Name="\"\\\"MemChecker"\\\"\"
20 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
21 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
21 DEFINES += driver_Version="\"\\\"1.0.1"\\\"\"
22 DEFINES += driver_Version="\"\\\"1.0.1"\\\"\"
22 DEFINES += driver_Description="\"\\\"Memory controler driver, works with ESA's LEON2 memory controler."\\\"\"
23 DEFINES += driver_Description="\"\\\"Memory controler driver, works with ESA's LEON2 memory controler."\\\"\"
23 DEFINES += driver_can_be_root=0
24 DEFINES += driver_can_be_root=0
24 DEFINES += driver_can_be_child=1
25 DEFINES += driver_can_be_child=1
25 DEFINES += driver_VID=0x04
26 DEFINES += driver_VID=0x04
26 DEFINES += driver_PID=0x0f
27 DEFINES += driver_PID=0x0f
27
28
28 #LIBS +=-llppmoncommon
29 #LIBS +=-llppmoncommon
29
30
30 INCLUDEPATH += \
31 INCLUDEPATH += \
31 $${PWD}
32 $${PWD}
32
33
33 HEADERS += \
34 HEADERS += \
34 memcheckplugin.h \
35 memcheckplugin.h \
35 memcheckplugin_ui.h \
36 memcheckplugin_ui.h \
36 memchecker.h
37 memchecker.h
37
38
38 SOURCES += \
39 SOURCES += \
39 memcheckplugin.cpp \
40 memcheckplugin.cpp \
40 memcheckplugin_ui.cpp \
41 memcheckplugin_ui.cpp \
41 memchecker.cpp
42 memchecker.cpp
42
43
43 FORMS += \
44 FORMS += \
44 memcheckplugin_ui.ui
45 memcheckplugin_ui.ui
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
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
@@ -1,67 +1,68
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "memcheckplugin_ui.h"
22 #include "memcheckplugin_ui.h"
23 #include "ui_memcheckplugin_ui.h"
23 #include "ui_memcheckplugin_ui.h"
24 #include <memsizewdgt.h>
24 #include <memsizewdgt.h>
25 #include <qhexspinbox.h>
25 #include <qhexspinbox.h>
26
26
27 memcheckplugin_ui::memcheckplugin_ui(QWidget *parent) :
27 memcheckplugin_ui::memcheckplugin_ui(QWidget *parent) :
28 QWidget(parent),
28 QWidget(parent),
29 ui(new Ui::memcheckplugin_ui)
29 ui(new Ui::memcheckplugin_ui)
30 {
30 {
31 ui->setupUi(this);
31 ui->setupUi(this);
32 connect(this->ui->StartTestQpb,SIGNAL(clicked()),this,SLOT(startCheck()));
32 connect(this->ui->StartTestQpb,SIGNAL(clicked()),this,SLOT(startCheck()));
33 }
33 }
34
34
35 memcheckplugin_ui::~memcheckplugin_ui()
35 memcheckplugin_ui::~memcheckplugin_ui()
36 {
36 {
37 delete ui;
37 delete ui;
38 }
38 }
39
39
40 void memcheckplugin_ui::startCheck()
40 void memcheckplugin_ui::startCheck()
41 {
41 {
42 if(this->ui->testTypeQchkBx->currentText()=="Check data bits")
42 if(this->ui->testTypeQchkBx->currentText()=="Check data bits")
43 {
43 {
44 emit checkdatabits(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
44 emit checkdatabits(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
45 }
45 }
46 if(this->ui->testTypeQchkBx->currentText()=="Check memory size")
46 if(this->ui->testTypeQchkBx->currentText()=="Check memory size")
47 {
47 {
48 emit checkmemory(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
48 //emit checkmemory(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
49 emit checkmemorySize(this->ui->StartAddress->value(),this->ui->MemSize->getsize());
49 }
50 }
50 if(this->ui->testTypeQchkBx->currentText()=="Full test")
51 if(this->ui->testTypeQchkBx->currentText()=="Full test")
51 {
52 {
52
53
53 }
54 }
54 }
55 }
55
56
56 void memcheckplugin_ui::setResult(bool success, QString repport)
57 void memcheckplugin_ui::setResult(bool success, QString repport)
57 {
58 {
58 this->ui->testDetails->setText(repport);
59 this->ui->testDetails->setText(repport);
59 if(success)
60 if(success)
60 {
61 {
61 this->ui->TestResult->setText("Success");
62 this->ui->TestResult->setText("Success");
62 }
63 }
63 else
64 else
64 {
65 {
65 this->ui->TestResult->setText("Failed");
66 this->ui->TestResult->setText("Failed");
66 }
67 }
67 }
68 }
@@ -1,48 +1,49
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef MEMCHECKPLUGIN_UI_H
22 #ifndef MEMCHECKPLUGIN_UI_H
23 #define MEMCHECKPLUGIN_UI_H
23 #define MEMCHECKPLUGIN_UI_H
24
24
25 #include <QWidget>
25 #include <QWidget>
26
26
27 namespace Ui {
27 namespace Ui {
28 class memcheckplugin_ui;
28 class memcheckplugin_ui;
29 }
29 }
30
30
31 class memcheckplugin_ui : public QWidget
31 class memcheckplugin_ui : public QWidget
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34
34
35 public:
35 public:
36 explicit memcheckplugin_ui(QWidget *parent = 0);
36 explicit memcheckplugin_ui(QWidget *parent = 0);
37 ~memcheckplugin_ui();
37 ~memcheckplugin_ui();
38 public slots:
38 public slots:
39 void startCheck();
39 void startCheck();
40 void setResult(bool success,QString repport);
40 void setResult(bool success,QString repport);
41 signals:
41 signals:
42 void checkmemory(unsigned int address,unsigned int size);
42 void checkmemory(unsigned int address,unsigned int size);
43 void checkmemorySize(unsigned int address,unsigned int size);
43 void checkdatabits(unsigned int address,unsigned int size);
44 void checkdatabits(unsigned int address,unsigned int size);
44 private:
45 private:
45 Ui::memcheckplugin_ui *ui;
46 Ui::memcheckplugin_ui *ui;
46 };
47 };
47
48
48 #endif // MEMCHECKPLUGIN_UI_H
49 #endif // MEMCHECKPLUGIN_UI_H
@@ -1,73 +1,73
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 CONFIG(debug, debug|release) {
10 #CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
11 # DEBUG_EXT = _d
12 } else {
12 #} else {
13 DEBUG_EXT =
13 # DEBUG_EXT =
14 }
14 #}
15
15
16 TARGET = memctrlrplugin$${DEBUG_EXT}
16 TARGET = memctrlrplugin #$${DEBUG_EXT}
17 DEFINES += PLUGIN=memctrlrplugin
17 DEFINES += PLUGIN=memctrlrplugin
18 DEFINES += PLUGINHEADER="\"\\\"memctrlrplugin.h"\\\"\"
18 DEFINES += PLUGINHEADER="\"\\\"memctrlrplugin.h"\\\"\"
19 DEFINES += driver_Name="\"\\\"MemControler"\\\"\"
19 DEFINES += driver_Name="\"\\\"MemControler"\\\"\"
20 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
20 DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@lpp.polytechnique.fr"\\\"\"
21 DEFINES += driver_Version="\"\\\"1.0.1"\\\"\"
21 DEFINES += driver_Version="\"\\\"1.0.1"\\\"\"
22 DEFINES += driver_Description="\"\\\"Memory controler driver, works with ESA's LEON2 memory controler."\\\"\"
22 DEFINES += driver_Description="\"\\\"Memory controler driver, works with ESA's LEON2 memory controler."\\\"\"
23 DEFINES += driver_can_be_root=0
23 DEFINES += driver_can_be_root=0
24 DEFINES += driver_can_be_child=1
24 DEFINES += driver_can_be_child=1
25 DEFINES += driver_VID=0x04
25 DEFINES += driver_VID=0x04
26 DEFINES += driver_PID=0x0f
26 DEFINES += driver_PID=0x0f
27
27
28 #LIBS +=-llppmoncommon
28 #LIBS +=-llppmoncommon
29
29
30 INCLUDEPATH += \
30 INCLUDEPATH += \
31 $${PWD}
31 $${PWD}
32
32
33 HEADERS += \
33 HEADERS += \
34 memctrlrplugin.h \
34 memctrlrplugin.h \
35 memctrlrpluginui.h \
35 memctrlrpluginui.h \
36 memorycheck.h \
36 memorycheck.h \
37 genericmemoryspacecheck.h \
37 genericmemoryspacecheck.h \
38 memctrlrpywrapper.h
38 memctrlrpywrapper.h
39
39
40 SOURCES += \
40 SOURCES += \
41 memctrlrplugin.cpp \
41 memctrlrplugin.cpp \
42 memctrlrpluginui.cpp \
42 memctrlrpluginui.cpp \
43 memorycheck.cpp \
43 memorycheck.cpp \
44 genericmemoryspacecheck.cpp \
44 genericmemoryspacecheck.cpp \
45 memctrlrpywrapper.cpp
45 memctrlrpywrapper.cpp
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
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
72
72
73
73
General Comments 0
You need to be logged in to leave comments. Login now