summaryrefslogtreecommitdiffstats
path: root/servers/fpga_server_lin
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-04 20:29:14 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-04 20:29:14 -0500
commitd5316f5795e3557d032af9a95ba4e5fa88191834 (patch)
treed083b877c06dc8f1e98a49c29c25ee9dbec06644 /servers/fpga_server_lin
parentb5fa21be6e5c4e07494186343c9b1d7fa5d801fb (diff)
downloadulab-d5316f5795e3557d032af9a95ba4e5fa88191834.tar.gz
ulab-d5316f5795e3557d032af9a95ba4e5fa88191834.zip
Add interface mode selection
Make servers use less CPU
Diffstat (limited to 'servers/fpga_server_lin')
-rw-r--r--servers/fpga_server_lin/src/fpga_conn.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp
index 6f4cecf..3acd499 100644
--- a/servers/fpga_server_lin/src/fpga_conn.cpp
+++ b/servers/fpga_server_lin/src/fpga_conn.cpp
@@ -161,13 +161,16 @@ int FPGASocket::setupSerial() {
void FPGASocket::commandLoop() {
int cc;
char buffer[10000];
+ bool transferred_data;
m_criticalSection++;
try {
+ transferred_data = false;
if (state() == TQSocket::Connected) {
cc = read(m_fd_tty, buffer, 10000);
if (cc > 0) {
writeBlock(buffer, cc);
+ transferred_data = true;
printf("[DEBUG] Got %d bytes from the serial port\n\r", cc); fflush(stdout);
}
if (canReadData()) {
@@ -176,12 +179,18 @@ void FPGASocket::commandLoop() {
if (write(m_fd_tty, buffer, cc) < 0) {
// ERROR
}
+ transferred_data = true;
printf("[DEBUG] Got %d bytes from the network interface\n\r", cc); fflush(stdout);
}
}
}
m_criticalSection--;
- if (m_loopTimer) m_loopTimer->start(0, TRUE);
+ if (transferred_data) {
+ if (m_loopTimer) m_loopTimer->start(0, TRUE);
+ }
+ else {
+ if (m_loopTimer) m_loopTimer->start(100, TRUE);
+ }
return;
}
catch (...) {