##// END OF EJS Templates
Improved memory size measurement. Slower but generates less errors.
Jeandet Alexis -
r114:54b9f2f11e09 0.6 draft
parent child
Show More
@@ -57,19 +57,29 unsigned int MemTester::measureMemSize(s
57 testAddress = (unsigned int)(address+(1<<size));
57 testAddress = (unsigned int)(address+(1<<size));
58 curVal = (unsigned int)(1<<size);
58 curVal = (unsigned int)(1<<size);
59 plugin->Write(&curVal,1,testAddress);
59 plugin->Write(&curVal,1,testAddress);
60 plugin->Read(&curVal,1,testAddress);
60 if(!MemTester::m_check_space(plugin,address,size))
61 if((unsigned int)curVal!=(unsigned int)(1<<size))
61 return (1<<(size));
62 return (1<<(size));
63 plugin->Read(&curVal,1,address);
64 if((curVal==(unsigned int)(1<<size)) && (size!=0))
65 return (1<<(size));
66 }
62 }
67 return (1<<(size+1));
63 return (1<<(size+1));
68 }
64 }
69
65
70 unsigned int MemTester::measureMemSize(const QString &plugin, unsigned int address, unsigned int maxSize)
66 unsigned int MemTester::measureMemSize(const QString &plugin, unsigned int address, unsigned int maxSize)
71 {
67 {
72 return measureMemSize(socexplorerproxy::findPlugin(plugin),address,maxSize);
68 return measureMemSize(socexplorerproxy::findPlugin(plugin),address,maxSize);
69 }
70
71 bool MemTester::m_check_space(socexplorerplugin *plugin,unsigned int address, unsigned int pow)
72 {
73 unsigned int currentAddress=4;
74 unsigned int curVal=0xffffff;
75 while (currentAddress<=(1<<pow))
76 {
77 plugin->Read(&curVal,1,address+currentAddress);
78 if(curVal!=currentAddress)
79 return false;
80 currentAddress = currentAddress <<1;
81 }
82 return true;
73 }
83 }
74
84
75
85
@@ -14,6 +14,8 public:
14 static unsigned int measureMemSize(const QString& plugin, unsigned int address,unsigned int maxSize=0xFFFFFFFF);
14 static unsigned int measureMemSize(const QString& plugin, unsigned int address,unsigned int maxSize=0xFFFFFFFF);
15 public slots:
15 public slots:
16
16
17 private:
18 static bool m_check_space(socexplorerplugin* plugin,unsigned int address, unsigned int pow);
17 };
19 };
18
20
19 #endif // MEMTESTER_H
21 #endif // MEMTESTER_H
General Comments 0
You need to be logged in to leave comments. Login now