summaryrefslogtreecommitdiff
path: root/nuttx/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-12-01 22:13:03 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-12-01 22:13:03 +0000
commit0f895f0ed4b2370af37d91c0ecb7649d914ed147 (patch)
tree0aed3e4de0338044be420062103f72c88a430fa3 /nuttx/examples
parent2e5d80f7a34c92e7182b549bd35e0b218fd100a4 (diff)
downloadpx4-nuttx-0f895f0ed4b2370af37d91c0ecb7649d914ed147.tar.gz
px4-nuttx-0f895f0ed4b2370af37d91c0ecb7649d914ed147.tar.bz2
px4-nuttx-0f895f0ed4b2370af37d91c0ecb7649d914ed147.zip
Fixed for multi-user NX mode
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1386 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples')
-rw-r--r--nuttx/examples/README.txt25
-rw-r--r--nuttx/examples/nx/nx_internal.h5
-rw-r--r--nuttx/examples/nx/nx_main.c23
3 files changed, 51 insertions, 2 deletions
diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt
index f2a597800..2fbb54e8f 100644
--- a/nuttx/examples/README.txt
+++ b/nuttx/examples/README.txt
@@ -54,6 +54,31 @@ examples/nsh
someday be a great NuttX application debugger. NSH is described
in its own README located at examples/nsh/README.txt
+examples/nx
+^^^^^^^^^^^
+
+ This directory contains a simple test of a subset of the NX APIs
+ defined in include/nuttx/nx.h. The following configuration options
+ can be selected:
+
+ CONFIG_EXAMPLES_NX_VPLANE -- The plane to select from the frame-
+ buffer driver for use in the test. Default: 0
+ CONFIG_EXAMPLES_NX_BGCOLOR -- The color of the background. Default: ' '.
+ CONFIG_EXAMPLES_NX_COLOR1 -- The color of window 1. Default: '1'
+ CONFIG_EXAMPLES_NX_COLOR2 -- The color of window 2. Default: '2'
+
+ This test can be performed with either the single-user version of
+ NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER.
+ If CONFIG_NX_MULTIUSER is defined, then the following configuration
+ options also apply:
+
+ CONFIG_EXAMPLES_NX_STACKSIZE -- The stacksize to use when creating
+ the NX server. Default 2048
+ CONFIG_EXAMPLES_NX_CLIENTPRIO -- The client priority. Default: 80
+ CONFIG_EXAMPLES_NX_SERVERPRIO -- The server priority. Default: 120
+ CONFIG_EXAMPLES_NX_NOTIFYSIGNO -- The signal number to use with
+ nx_eventnotify(). Default: 4
+
examples/null
^^^^^^^^^^^^^
diff --git a/nuttx/examples/nx/nx_internal.h b/nuttx/examples/nx/nx_internal.h
index d41bbf89f..60ec466e2 100644
--- a/nuttx/examples/nx/nx_internal.h
+++ b/nuttx/examples/nx/nx_internal.h
@@ -97,8 +97,11 @@
# ifndef CONFIG_EXAMPLES_NX_STACKSIZE
# define CONFIG_EXAMPLES_NX_STACKSIZE 2048
# endif
+# ifndef CONFIG_EXAMPLES_NX_CLIENTPRIO
+# define CONFIG_EXAMPLES_NX_CLIENTPRIO 80
+# endif
# ifndef CONFIG_EXAMPLES_NX_SERVERPRIO
-# define CONFIG_EXAMPLES_NX_SERVERPRIO 100
+# define CONFIG_EXAMPLES_NX_SERVERPRIO 120
# endif
# ifndef CONFIG_EXAMPLES_NX_NOTIFYSIGNO
# define CONFIG_EXAMPLES_NX_NOTIFYSIGNO 4
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c
index 039b1645e..f30fef119 100644
--- a/nuttx/examples/nx/nx_main.c
+++ b/nuttx/examples/nx/nx_main.c
@@ -485,7 +485,28 @@ static inline int nxeg_muinitialize(void)
while (!g_connected)
{
- (void)sem_wait(&g_semevent);
+ /* Assuming that the incoming message queue is configured non-blocking,
+ * we can poll the event handler here. This accounts for the case where
+ * the server is higher prioirty than the client. In that case, the
+ * server will have already responded to the connection request BEFORE
+ * the nx_eventnotify was called.
+ */
+
+ ret = nx_eventhandler(g_hnx);
+ if (ret == 0)
+ {
+ /* If a message was received, then we are connected */
+
+ g_connected = TRUE;
+ }
+
+ /* Otherwise, we will have to wait for the event handler to wake up up
+ * when we really are connected.
+ */
+ else
+ {
+ (void)sem_wait(&g_semevent);
+ }
}
}
else