##// END OF EJS Templates
Added cache enable/disable on dsu3plugin....
jeandet -
r44:0935da2bcc7f default
parent child
Show More
@@ -8,13 +8,13 CONFIG += socexplorerplugin
8 8 win32:CONFIG += dll
9 9 win32:CONFIG -= static
10 10
11 CONFIG(debug, debug|release) {
12 DEBUG_EXT = _d
13 } else {
14 DEBUG_EXT =
15 }
11 #CONFIG(debug, debug|release) {
12 # DEBUG_EXT = _d
13 #} else {
14 # DEBUG_EXT =
15 #}
16 16
17 TARGET = ApbUartPlugin$${DEBUG_EXT}
17 TARGET = ApbUartPlugin #$${DEBUG_EXT}
18 18
19 19 DEFINES += PLUGIN=ApbUartPlugin
20 20 DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\"
@@ -7,12 +7,12 CONFIG += socexplorerplugin
7 7 TEMPLATE = lib
8 8 CONFIG += dll
9 9 CONFIG -= static
10 CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
12 } else {
13 DEBUG_EXT =
14 }
15 TARGET = ahbuartplugin$${DEBUG_EXT}
10 #CONFIG(debug, debug|release) {
11 # DEBUG_EXT = _d
12 #} else {
13 # DEBUG_EXT =
14 #}
15 TARGET = ahbuartplugin #$${DEBUG_EXT}
16 16 DEFINES += PLUGIN=ahbuartplugin
17 17 DEFINES += PLUGINHEADER="\"\\\"ahbuartplugin.h"\\\"\"
18 18 DEFINES += driver_Name="\"\\\"AHBUARTplugin"\\\"\"
@@ -6,12 +6,12
6 6 CONFIG += socexplorerplugin
7 7 CONFIG += dll
8 8 CONFIG -= static
9 CONFIG(debug, debug|release) {
10 DEBUG_EXT = _d
11 } else {
12 DEBUG_EXT =
13 }
14 TARGET = ambaplugin$${DEBUG_EXT}
9 #CONFIG(debug, debug|release) {
10 # DEBUG_EXT = _d
11 #} else {
12 # DEBUG_EXT =
13 #}
14 TARGET = ambaplugin #$${DEBUG_EXT}
15 15 DEFINES += PLUGIN=ambaplugin
16 16 DEFINES += PLUGINHEADER="\"\\\"ambaplugin.h"\\\"\"
17 17 DEFINES += driver_Name="\"\\\"AMBA_PLUGIN"\\\"\"
@@ -25,6 +25,24
25 25 #include "dsu3pluginpywrapper.h"
26 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 46 dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false)
29 47 {
30 48 this->UI = new dsu3pluginui();
@@ -35,6 +53,10 dsu3plugin::dsu3plugin(QWidget *parent):
35 53 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
36 54 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
37 55 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
56 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheEnable()),this,SLOT(cacheEnable()));
57 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheDisable()),this,SLOT(cacheDisable()));
58 QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(setCacheEnable(bool)),this,SLOT(setCacheEnable(bool)));
59
38 60 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
39 61 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
40 62 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
@@ -71,17 +93,18 bool dsu3plugin::configureTarget()
71 93 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
72 94 if(DSUBASEADDRESS == (unsigned int)-1)
73 95 DSUBASEADDRESS = 0x90000000;
74 unsigned int MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x04 , 0x00F,0);
96 unsigned int MCTRLBASEADDRESS =-1;
97 for(int i=0; i<acceptedMemctrlrCnt;i++)
98 {
99 MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,acceptedMemctrlr[i].vid , acceptedMemctrlr[i].pid,0);
100 if(MCTRLBASEADDRESS != (unsigned int)-1) break;
101 }
75 102 if(MCTRLBASEADDRESS == (unsigned int)-1)
76 103 {
77 SocExplorerEngine::message(this,"Can't find MemCtrlr",1);
78 MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x051,0);
79 if(MCTRLBASEADDRESS == (unsigned int)-1)
80 {
81 SocExplorerEngine::message(this,"Can't find FTMemCtrlr",1);
104 //SocExplorerEngine::message(this,"Can't find FTMemCtrlr",1);
82 105 return false;
83 106 }
84 }
107
85 108
86 109 //Force a debug break
87 110 WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS);
@@ -133,10 +156,43 bool dsu3plugin::configureTarget()
133 156 return true;
134 157 }
135 158
159 bool dsu3plugin::cacheDisable()
160 {
161 return setCacheEnable(false);
162 }
163
164 bool dsu3plugin::cacheEnable()
165 {
166 return setCacheEnable(true);
167 }
168
169 bool dsu3plugin::setCacheEnable(bool enabled)
170 {
171 if(parent==NULL)
172 return false;
173 unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0);
174 if(DSUBASEADDRESS == (unsigned int)-1)
175 DSUBASEADDRESS = 0x90000000;
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;
189 }
190
136 191 bool dsu3plugin::flashTarget()
137 192 {
193 stop();
194 cacheDisable();
138 195 configureTarget();
139
140 196 /*Write .text*/
141 197 this->writeSection(".text");
142 198 /*Write .data*/
@@ -46,6 +46,9 public slots:
46 46 void openFile();
47 47 void openFile(QString fileName);
48 48 bool configureTarget();
49 bool cacheDisable();
50 bool cacheEnable();
51 bool setCacheEnable(bool enabled);
49 52 bool flashTarget();
50 53 void run();
51 54 void stop();
@@ -7,17 +7,17 CONFIG += socexplorerplugin
7 7
8 8 TEMPLATE = lib
9 9
10 CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
12 } else {
13 DEBUG_EXT =
14 }
10 #CONFIG(debug, debug|release) {
11 # DEBUG_EXT = _d
12 #} else {
13 # DEBUG_EXT =
14 #}
15 15
16 16 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
17 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 22 DEFINES += PLUGIN=dsu3plugin
23 23 DEFINES += PLUGINHEADER="\"\\\"dsu3plugin.h"\\\"\"
@@ -13,6 +13,9 signals:
13 13 bool loadFile();
14 14 bool run();
15 15 bool stop();
16 bool cacheDisable();
17 bool cacheEnable();
18 bool setCacheEnable(bool enabled);
16 19 public slots:
17 20
18 21 };
@@ -7,12 +7,12 CONFIG += socexplorerplugin
7 7 CONFIG += dll
8 8 CONFIG -= static
9 9
10 CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
12 } else {
13 DEBUG_EXT =
14 }
15 TARGET = genericrwplugin$${DEBUG_EXT}
10 #CONFIG(debug, debug|release) {
11 # DEBUG_EXT = _d
12 #} else {
13 # DEBUG_EXT =
14 #}
15 TARGET = genericrwplugin #$${DEBUG_EXT}
16 16 DEFINES += PLUGIN=genericrwplugin
17 17 DEFINES += PLUGINHEADER="\"\\\"genericrwplugin.h"\\\"\"
18 18 DEFINES += driver_Name="\"\\\"GenericRWplugin"\\\"\"
@@ -56,3 +56,58 QString memchecker::checkdatabits(unsign
56 56 }
57 57
58 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;
81 }
82
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
@@ -31,6 +31,7 public:
31 31 QString checkmemory(unsigned int address,unsigned int size,bool* success);
32 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 35 private:
35 36 socexplorerplugin* plugin;
36 37 };
@@ -28,6 +28,7 memcheckplugin::memcheckplugin(QWidget *
28 28 this->checker = new memchecker(this);
29 29 QObject::connect(this->UI,SIGNAL(checkdatabits(uint,uint)),this,SLOT(checkdatabits(uint,uint)));
30 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 34 memcheckplugin::~memcheckplugin()
@@ -42,6 +43,22 void memcheckplugin::checkmemory(unsigne
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 62 void memcheckplugin::checkdatabits(unsigned int address, unsigned int size)
46 63 {
47 64 bool success;
@@ -59,6 +59,7 public:
59 59 ~memcheckplugin();
60 60 public slots:
61 61 void checkmemory(unsigned int address,unsigned int size);
62 void checkmemorySize(unsigned int address,unsigned int size);
62 63 void checkdatabits(unsigned int address,unsigned int size);
63 64 signals:
64 65
@@ -7,13 +7,14 CONFIG += socexplorerplugin
7 7 CONFIG += dll
8 8 CONFIG -= static
9 9
10 CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
12 } else {
13 DEBUG_EXT =
14 }
10 #CONFIG(debug, debug|release) {
11 # DEBUG_EXT = _d
12 #} else {
13 # DEBUG_EXT =
14 #}
15 15
16 TARGET = memcheckplugin$${DEBUG_EXT}
16
17 TARGET = memcheckplugin #$${DEBUG_EXT}
17 18 DEFINES += PLUGIN=memcheckplugin
18 19 DEFINES += PLUGINHEADER="\"\\\"memcheckplugin.h"\\\"\"
19 20 DEFINES += driver_Name="\"\\\"MemChecker"\\\"\"
@@ -45,7 +45,8 void memcheckplugin_ui::startCheck()
45 45 }
46 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 51 if(this->ui->testTypeQchkBx->currentText()=="Full test")
51 52 {
@@ -40,6 +40,7 public slots:
40 40 void setResult(bool success,QString repport);
41 41 signals:
42 42 void checkmemory(unsigned int address,unsigned int size);
43 void checkmemorySize(unsigned int address,unsigned int size);
43 44 void checkdatabits(unsigned int address,unsigned int size);
44 45 private:
45 46 Ui::memcheckplugin_ui *ui;
@@ -7,13 +7,13 CONFIG += socexplorerplugin
7 7 CONFIG += dll
8 8 CONFIG -= static
9 9
10 CONFIG(debug, debug|release) {
11 DEBUG_EXT = _d
12 } else {
13 DEBUG_EXT =
14 }
10 #CONFIG(debug, debug|release) {
11 # DEBUG_EXT = _d
12 #} else {
13 # DEBUG_EXT =
14 #}
15 15
16 TARGET = memctrlrplugin$${DEBUG_EXT}
16 TARGET = memctrlrplugin #$${DEBUG_EXT}
17 17 DEFINES += PLUGIN=memctrlrplugin
18 18 DEFINES += PLUGINHEADER="\"\\\"memctrlrplugin.h"\\\"\"
19 19 DEFINES += driver_Name="\"\\\"MemControler"\\\"\"
General Comments 0
You need to be logged in to leave comments. Login now