summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/src/cnxserver.cxx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-12-29 09:46:57 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-12-29 09:46:57 -0600
commit513671256fe287033b8874d352fdf34bf6a14bea (patch)
treec92e6af03ccf0db0e7bc0492c37bdd1587e09e3d /NxWidgets/libnxwidgets/src/cnxserver.cxx
parent500e0bf8574e8257e709d4a45a2d8b6c84b9a8c4 (diff)
downloadnuttx-513671256fe287033b8874d352fdf34bf6a14bea.tar.gz
nuttx-513671256fe287033b8874d352fdf34bf6a14bea.tar.bz2
nuttx-513671256fe287033b8874d352fdf34bf6a14bea.zip
NxWidgets server initialization must be performed in the kernel when NxWdigets is built in kernel mode
Diffstat (limited to 'NxWidgets/libnxwidgets/src/cnxserver.cxx')
-rw-r--r--NxWidgets/libnxwidgets/src/cnxserver.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/NxWidgets/libnxwidgets/src/cnxserver.cxx b/NxWidgets/libnxwidgets/src/cnxserver.cxx
index 15f9bce5a..84f6701da 100644
--- a/NxWidgets/libnxwidgets/src/cnxserver.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxserver.cxx
@@ -1,7 +1,7 @@
/****************************************************************************
* NxWidgets/libnxwidgets/src/cnxserver.cxx
*
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -156,7 +156,8 @@ bool CNxServer::connect(void)
// Turn the LCD on at 75% power
(void)m_hDevice->setpower(m_hDevice, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
-#else
+
+#else // CONFIG_NX_LCDDRIVER
int ret;
// Initialize the frame buffer device
@@ -175,7 +176,8 @@ bool CNxServer::connect(void)
CONFIG_NXWIDGETS_VPLANE);
return false;
}
-#endif
+
+#endif // CONFIG_NX_LCDDRIVER
// Then open NX
@@ -188,7 +190,7 @@ bool CNxServer::connect(void)
return true;
}
-#endif
+#endif // CONFIG_NX_MULTIUSER
/**
* Connect to the NX Server -- Multi user version
@@ -212,6 +214,7 @@ bool CNxServer::connect(void)
return false;
}
+#ifdef CONFIG_NXWIDGET_SERVERINIT
// Start the server task
gvdbg("CNxServer::connect: Starting server task\n");
@@ -227,6 +230,8 @@ bool CNxServer::connect(void)
usleep(50*1000);
+#endif // CONFIG_NXWIDGET_SERVERINIT
+
// Connect to the server
m_hNxServer = nx_connect();
@@ -286,7 +291,7 @@ bool CNxServer::connect(void)
return true;
}
-#endif
+#endif // CONFIG_NX_MULTIUSER
/**
* Disconnect to the NX Server -- Single user version
@@ -303,7 +308,7 @@ void CNxServer::disconnect(void)
m_hNxServer = NULL;
}
}
-#endif
+#endif // CONFIG_NX_MULTIUSER
/**
* Disconnect to the NX Server -- Single user version
@@ -336,14 +341,14 @@ void CNxServer::disconnect(void)
m_hNxServer = NULL;
}
}
-#endif
+#endif // CONFIG_NX_MULTIUSER
/**
* NX server thread. This is the entry point into the server thread that
* serializes the multi-threaded accesses to the display.
*/
-#ifdef CONFIG_NX_MULTIUSER
+#if defined(CONFIG_NX_MULTIUSER) && defined(CONFIG_NXWIDGET_SERVERINIT)
int CNxServer::server(int argc, char *argv[])
{
FAR NX_DRIVERTYPE *dev;
@@ -381,7 +386,8 @@ int CNxServer::server(int argc, char *argv[])
// Turn the LCD on at 75% power
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
-#else
+
+#else // CONFIG_NX_LCDDRIVER
// Initialize the frame buffer device
ret = up_fbinitialize();
@@ -397,7 +403,8 @@ int CNxServer::server(int argc, char *argv[])
gdbg("up_fbgetvplane failed, vplane=%d\n", CONFIG_NXWIDGETS_VPLANE);
return 2;
}
-#endif
+
+#endif // CONFIG_NX_LCDDRIVER
// Then start the server
@@ -405,7 +412,7 @@ int CNxServer::server(int argc, char *argv[])
gvdbg("nx_run returned: %d\n", errno);
return EXIT_FAILURE;
}
-#endif
+#endif // CONFIG_NX_MULTIUSER && CONFIG_NXWIDGET_SERVERINIT
/**
* This is the entry point of a thread that listeners for and dispatches
@@ -458,4 +465,4 @@ FAR void *CNxServer::listener(FAR void *arg)
sem_post(&This->m_connsem);
return NULL;
}
-#endif
+#endif // CONFIG_NX_MULTIUSER