##// END OF EJS Templates
Fixed bug on AHBUART (wrong mutex usage).
Jeandet Alexis -
r30:be684d1d67fb default
parent child
Show More
@@ -90,7 +90,7 void UARTPollingThread::run()
90 90 SocExplorerEngine::message(this->plugin,QString("Received one char from APBUART"),3);
91 91 emit this->apbUartTextReceived(QString(ch[0]));
92 92 }
93 msleep(1);
93 msleep(10);
94 94 }
95 95 }
96 96 }
@@ -95,6 +95,7 bool ahbuartplugin::checkConnection()
95 95 int read = 0;
96 96 timeout.start();
97 97 SocExplorerEngine::message(this,"Check connection",2);
98 QMutexLocker lock(portMutex);
98 99 while(writen!=5)
99 100 {
100 101 writen+=rs232write(this->port,test+writen,5-writen);
@@ -131,6 +132,7 void ahbuartplugin::connectPort(QString
131 132 QTime timeout;
132 133 SocExplorerEngine::message(this,"Try to connect to port "+PortName,2);
133 134 timeout.start();
135 QMutexLocker lock(portMutex);
134 136 if(this->port==(rs232port_t)NULL)
135 137 {
136 138 SocExplorerEngine::message(this,"Open port "+PortName,2);
@@ -232,8 +234,9 unsigned int ahbuartplugin::Read(unsigne
232 234 SocExplorerEngine::message(this,QString("Read ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
233 235 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
234 236 {
235 if(!this->portMutex->tryLock())
236 return 0;
237 QMutexLocker lock(portMutex);
238 // if(!this->portMutex->tryLock())
239 // return 0;
237 240 if(!this->checkConnection())
238 241 {
239 242 this->Connected = false;
@@ -304,7 +307,7 unsigned int ahbuartplugin::Read(unsigne
304 307 if(cnt>128)
305 308 SocExplorerEngine::deleteProgressBar(progress);
306 309 free(result);
307 this->portMutex->unlock();
310 // this->portMutex->unlock();
308 311 }
309 312 return read/4;
310 313 }
@@ -318,8 +321,9 unsigned int ahbuartplugin::Write(unsign
318 321 SocExplorerEngine::message(this,QString("Write ")+ QString::number(count) + QString(" words @0x")+ QString::number(address,16),2);
319 322 if((this->port!= badPortValue)||(this->port!=(rs232port_t)NULL))
320 323 {
321 if(!this->portMutex->tryLock())
322 return 0;
324 QMutexLocker lock(portMutex);
325 // if(!this->portMutex->tryLock())
326 // return 0;
323 327 if(!this->checkConnection())
324 328 {
325 329 emit this->activateSig(false);
@@ -384,7 +388,7 unsigned int ahbuartplugin::Write(unsign
384 388 SocExplorerEngine::deleteProgressBar(progress);
385 389 }
386 390 free(CMD);
387 this->portMutex->unlock();
391 // this->portMutex->unlock();
388 392 return writen;
389 393 }
390 394 return 0;
General Comments 0
You need to be logged in to leave comments. Login now