@@ -68,6 +68,9 void ApbUartPlugin::loopbackChangeState( | |||||
68 |
|
68 | |||
69 | void ApbUartPlugin::uartReadout() |
|
69 | void ApbUartPlugin::uartReadout() | |
70 | { |
|
70 | { | |
|
71 | #ifdef WIN32 | |||
|
72 | int readcnt=0; | |||
|
73 | #endif | |||
71 | if(this->isEnabled() && parent!=NULL) |
|
74 | if(this->isEnabled() && parent!=NULL) | |
72 | { |
|
75 | { | |
73 | if(this->useLoopBack) |
|
76 | if(this->useLoopBack) | |
@@ -83,11 +86,19 void ApbUartPlugin::uartReadout() | |||||
83 | parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG); |
|
86 | parent->Read(&data,1,this->baseAddress()+APB_UART_FIFO_DEBUG_REG); | |
84 | ch = (char)(0xff & data); |
|
87 | ch = (char)(0xff & data); | |
85 | printdata+=ch; |
|
88 | printdata+=ch; | |
|
89 | #ifdef WIN32 | |||
|
90 | readcnt++; | |||
|
91 | if(readcnt>=32) | |||
|
92 | { | |||
|
93 | qApp->processEvents(); | |||
|
94 | break; | |||
|
95 | } | |||
|
96 | #endif | |||
86 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); |
|
97 | parent->Read(&status_reg,1,this->baseAddress()+APB_UART_STATUS_REG); | |
87 | } |
|
98 | } | |
88 | if(printdata!="") |
|
99 | if(printdata!="") | |
89 | emit apbUartTextReceived(printdata); |
|
100 | emit apbUartTextReceived(printdata); | |
90 | this->loopBackTimer.start(); |
|
101 | this->loopBackTimer.start(200); | |
91 | } |
|
102 | } | |
92 | else |
|
103 | else | |
93 | { |
|
104 | { |
@@ -105,6 +105,9 bool ahbuartplugin::checkConnection() | |||||
105 | return false; |
|
105 | return false; | |
106 | } |
|
106 | } | |
107 | } |
|
107 | } | |
|
108 | #ifdef WIN32 | |||
|
109 | usleep(1000); | |||
|
110 | #endif | |||
108 | timeout.restart(); |
|
111 | timeout.restart(); | |
109 | while(read!=4) |
|
112 | while(read!=4) | |
110 | { |
|
113 | { | |
@@ -253,6 +256,9 unsigned int ahbuartplugin::Read(unsigne | |||||
253 | CMD[4] = (char)((address)&0xFF); |
|
256 | CMD[4] = (char)((address)&0xFF); | |
254 | // APENDTABLETOLOG(CMD,5,logmessage,"Write CMD : "); |
|
257 | // APENDTABLETOLOG(CMD,5,logmessage,"Write CMD : "); | |
255 | SAFEWRITE(CMD,5,timeout,1000,return 0); |
|
258 | SAFEWRITE(CMD,5,timeout,1000,return 0); | |
|
259 | #ifdef WIN32 | |||
|
260 | usleep(1000); | |||
|
261 | #endif | |||
256 | SAFEREAD(result+((cnt-count)*4),32*4,timeout,1000,return 0); |
|
262 | SAFEREAD(result+((cnt-count)*4),32*4,timeout,1000,return 0); | |
257 | // APENDTABLETOLOG((result+((cnt-count)*4)),32*4,logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); |
|
263 | // APENDTABLETOLOG((result+((cnt-count)*4)),32*4,logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); | |
258 | count-=32; |
|
264 | count-=32; | |
@@ -276,6 +282,9 unsigned int ahbuartplugin::Read(unsigne | |||||
276 | CMD[3] = (char)((address>>8)&0xFF); |
|
282 | CMD[3] = (char)((address>>8)&0xFF); | |
277 | CMD[4] = (char)((address)&0xFF); |
|
283 | CMD[4] = (char)((address)&0xFF); | |
278 | SAFEWRITE(CMD,5,timeout,1000,return 0); |
|
284 | SAFEWRITE(CMD,5,timeout,1000,return 0); | |
|
285 | #ifdef WIN32 | |||
|
286 | usleep(1000); | |||
|
287 | #endif | |||
279 | SAFEREAD(result+((cnt-count)*4),(count*4),timeout,1000,return 0); |
|
288 | SAFEREAD(result+((cnt-count)*4),(count*4),timeout,1000,return 0); | |
280 | // APENDTABLETOLOG((result+((cnt-count)*4)),(count*4),logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); |
|
289 | // APENDTABLETOLOG((result+((cnt-count)*4)),(count*4),logmessage, QString("Get ") + QString::number(32*4) + " Bytes : "); | |
281 | } |
|
290 | } |
General Comments 0
You need to be logged in to leave comments.
Login now