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