summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-12-27 14:30:13 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-12-27 14:30:13 -0600
commit44626834914016d6bc35945ad02421ed2be838d3 (patch)
tree628a70b1b03fa113a0b82c0e5072cc910f372ba9
parent148213e1695902cbfaccc8599cfa06871b8133f3 (diff)
downloadnuttx-44626834914016d6bc35945ad02421ed2be838d3.tar.gz
nuttx-44626834914016d6bc35945ad02421ed2be838d3.tar.bz2
nuttx-44626834914016d6bc35945ad02421ed2be838d3.zip
Decoupling NX user interfaces to support NX kernel build (phase 2)
-rw-r--r--nuttx/graphics/nxmu/Make.defs9
-rw-r--r--nuttx/graphics/nxmu/nxfe.h3
-rw-r--r--nuttx/graphics/nxmu/nxmu_sendclientwindow.c113
-rw-r--r--nuttx/graphics/nxmu/nxmu_sendwindow.c158
-rw-r--r--nuttx/include/nuttx/nx/nxmu.h4
-rw-r--r--nuttx/libc/nx/Make.defs11
-rw-r--r--nuttx/libc/nx/lib_nx_bitmap.c (renamed from nuttx/graphics/nxmu/nx_bitmap.c)11
-rw-r--r--nuttx/libc/nx/lib_nx_fill.c (renamed from nuttx/graphics/nxmu/nx_fill.c)10
-rw-r--r--nuttx/libc/nx/lib_nx_filltrapezoid.c (renamed from nuttx/graphics/nxmu/nx_filltrapezoid.c)10
-rw-r--r--nuttx/libc/nx/lib_nx_getposition.c (renamed from nuttx/graphics/nxmu/nx_getposition.c)9
-rw-r--r--nuttx/libc/nx/lib_nx_getrectangle.c (renamed from nuttx/graphics/nxmu/nx_getrectangle.c)8
-rw-r--r--nuttx/libc/nx/lib_nx_lower.c (renamed from nuttx/graphics/nxmu/nx_lower.c)7
-rw-r--r--nuttx/libc/nx/lib_nx_move.c (renamed from nuttx/graphics/nxmu/nx_move.c)9
-rw-r--r--nuttx/libc/nx/lib_nx_openwindow.c (renamed from nuttx/graphics/nxmu/nx_openwindow.c)15
-rw-r--r--nuttx/libc/nx/lib_nx_raise.c (renamed from nuttx/graphics/nxmu/nx_raise.c)7
-rw-r--r--nuttx/libc/nx/lib_nx_setpixel.c (renamed from nuttx/graphics/nxmu/nx_setpixel.c)8
-rw-r--r--nuttx/libc/nx/lib_nx_setposition.c (renamed from nuttx/graphics/nxmu/nx_setposition.c)9
-rw-r--r--nuttx/libc/nx/lib_nx_setsize.c (renamed from nuttx/graphics/nxmu/nx_setsize.c)9
-rw-r--r--nuttx/libc/nx/lib_nxmu_semtake.c (renamed from nuttx/graphics/nxmu/nxmu_semtake.c)4
-rw-r--r--nuttx/libc/nx/lib_nxmu_sendwindow.c115
20 files changed, 304 insertions, 225 deletions
diff --git a/nuttx/graphics/nxmu/Make.defs b/nuttx/graphics/nxmu/Make.defs
index 8c75ad6e1..666caeb45 100644
--- a/nuttx/graphics/nxmu/Make.defs
+++ b/nuttx/graphics/nxmu/Make.defs
@@ -35,14 +35,11 @@
NX_ASRCS =
-NXAPI_CSRCS = nx_bitmap.c nx_eventhandler.c nx_eventnotify.c nx_fill.c
-NXAPI_CSRCS += nx_filltrapezoid.c nx_getposition.c nx_getrectangle.c
-NXAPI_CSRCS += nx_lower.c nx_move.c nx_openwindow.c nx_raise.c
-NXAPI_CSRCS += nx_setpixel.c nx_setsize.c nx_setposition.c nx_drawcircle.c
-NXAPI_CSRCS += nx_drawline.c nx_fillcircle.c
+NXAPI_CSRCS = nx_eventhandler.c nx_eventnotify.c
+NXAPI_CSRCS += nx_drawcircle.c nx_drawline.c nx_fillcircle.c
NXMU_CSRCS = nxmu_kbdin.c nxmu_mouse.c nxmu_openwindow.c nxmu_redrawreq.c
NXMU_CSRCS += nxmu_releasebkgd.c nxmu_requestbkgd.c nxmu_reportposition.c
-NXMU_CSRCS += nxmu_sendclient.c nxmu_sendwindow.c nxmu_semtake.c nxmu_server.c
+NXMU_CSRCS += nxmu_sendclient.c nxmu_sendclientwindow.c nxmu_server.c
NX_CSRCS = $(NXAPI_CSRCS) $(NXMU_CSRCS)
diff --git a/nuttx/graphics/nxmu/nxfe.h b/nuttx/graphics/nxmu/nxfe.h
index a455f478d..34d680b2a 100644
--- a/nuttx/graphics/nxmu/nxfe.h
+++ b/nuttx/graphics/nxmu/nxfe.h
@@ -55,9 +55,6 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
-/* Handy macros */
-
-#define nxmu_semgive(sem) sem_post(sem) /* To match nxmu_semtake() */
/****************************************************************************
* Public Types
diff --git a/nuttx/graphics/nxmu/nxmu_sendclientwindow.c b/nuttx/graphics/nxmu/nxmu_sendclientwindow.c
new file mode 100644
index 000000000..655d815c9
--- /dev/null
+++ b/nuttx/graphics/nxmu/nxmu_sendclientwindow.c
@@ -0,0 +1,113 @@
+/****************************************************************************
+ * graphics/nxmu/nxmu_sendclientwindow.c
+ *
+ * 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
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <mqueue.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "nxfe.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxmu_sendclientwindow
+ *
+ * Description:
+ * Send a message to the client at NX_CLIMSG_PRIO priority
+ *
+ * Input Parameters:
+ * wnd - A pointer to the back-end window structure
+ * msg - A pointer to the message to send
+ * msglen - The length of the message in bytes.
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+
+int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
+ size_t msglen)
+{
+ int ret = OK;
+
+ /* Sanity checking */
+
+#ifdef CONFIG_DEBUG
+ if (!wnd || !wnd->conn)
+ {
+ set_errno(EINVAL);
+ return ERROR;
+ }
+#endif
+
+ /* Ignore messages destined to a blocked window (no errors reported) */
+
+ if (!NXBE_ISBLOCKED(wnd))
+ {
+ /* Send the message to the server */
+
+ ret = nxmu_sendclient(wnd->conn, msg, msglen);
+ }
+
+ return ret;
+}
diff --git a/nuttx/graphics/nxmu/nxmu_sendwindow.c b/nuttx/graphics/nxmu/nxmu_sendwindow.c
deleted file mode 100644
index 57fdd6b77..000000000
--- a/nuttx/graphics/nxmu/nxmu_sendwindow.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
- * graphics/nxmu/nxmu_sendserver.c
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <mqueue.h>
-#include <errno.h>
-#include <debug.h>
-
-#include "nxfe.h"
-
-/****************************************************************************
- * Pre-Processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: nxmu_sendwindow
- *
- * Description:
- * Send a message to the server destined for a specific window at
- * NX_SVRMSG_PRIO priority
- *
- * Input Parameters:
- * wnd - A pointer to the back-end window structure
- * msg - A pointer to the message to send
- * msglen - The length of the message in bytes.
- *
- * Return:
- * OK on success; ERROR on failure with errno set appropriately
- *
- ****************************************************************************/
-
-int nxmu_sendwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
- size_t msglen)
-{
- int ret = OK;
-
- /* Sanity checking */
-
-#ifdef CONFIG_DEBUG
- if (!wnd || !wnd->conn)
- {
- errno = EINVAL;
- return ERROR;
- }
-#endif
-
- /* Ignore messages destined to a blocked window (no errors reported) */
-
- if (!NXBE_ISBLOCKED(wnd))
- {
- /* Send the message to the server */
-
- ret = nxmu_sendserver(wnd->conn, msg, msglen);
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Name: nxmu_sendclientwindow
- *
- * Description:
- * Send a message to the client at NX_CLIMSG_PRIO priority
- *
- * Input Parameters:
- * wnd - A pointer to the back-end window structure
- * msg - A pointer to the message to send
- * msglen - The length of the message in bytes.
- *
- * Return:
- * OK on success; ERROR on failure with errno set appropriately
- *
- ****************************************************************************/
-
-int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
- size_t msglen)
-{
- int ret = OK;
-
- /* Sanity checking */
-
-#ifdef CONFIG_DEBUG
- if (!wnd || !wnd->conn)
- {
- errno = EINVAL;
- return ERROR;
- }
-#endif
-
- /* Ignore messages destined to a blocked window (no errors reported) */
-
- if (!NXBE_ISBLOCKED(wnd))
- {
- /* Send the message to the server */
-
- ret = nxmu_sendclient(wnd->conn, msg, msglen);
- }
-
- return ret;
-}
-
diff --git a/nuttx/include/nuttx/nx/nxmu.h b/nuttx/include/nuttx/nx/nxmu.h
index 55c33c612..a6a7ac145 100644
--- a/nuttx/include/nuttx/nx/nxmu.h
+++ b/nuttx/include/nuttx/nx/nxmu.h
@@ -83,6 +83,10 @@
#define NX_CLIMSG_PRIO 42
#define NX_SVRMSG_PRIO 42
+/* Handy macros */
+
+#define nxmu_semgive(sem) sem_post(sem) /* To match nxmu_semtake() */
+
/****************************************************************************
* Public Types
****************************************************************************/
diff --git a/nuttx/libc/nx/Make.defs b/nuttx/libc/nx/Make.defs
index 57f97f65a..8ac8adb48 100644
--- a/nuttx/libc/nx/Make.defs
+++ b/nuttx/libc/nx/Make.defs
@@ -42,10 +42,15 @@ ifeq ($(CONFIG_NX),y)
# build (single use mode cannot be used with the kernel build)
ifeq ($(CONFIG_NX_MULTIUSER),y)
-CSRCS += lib_nxmu_sendserver.c lib_nx_connect.c lib_nx_disconnect.c lib_nx_block.c
+CSRCS += lib_nxmu_sendserver.c lib_nx_connect.c lib_nx_disconnect.c
+CSRCS += lib_nxmu_semtake.c lib_nx_block.c
CSRCS += lib_nx_kbdchin.c lib_nx_kbdin.c lib_nx_mousein.c
-CSRCS += lib_nx_closewindow.c lib_nxmu_constructwindow.c lib_nx_releasebkgd.c
-CSRCS += lib_nx_requestbkgd.c lib_nx_setbgcolor.c
+CSRCS += lib_nx_releasebkgd.c lib_nx_requestbkgd.c lib_nx_setbgcolor.c
+
+CSRCS += lib_nxmu_sendwindow.c lib_nx_closewindow.c lib_nxmu_constructwindow.c
+CSRCS += lib_nx_bitmap.c lib_nx_fill.c lib_nx_filltrapezoid.c lib_nx_getposition.c
+CSRCS += lib_nx_getrectangle.c lib_nx_lower.c lib_nx_move.c lib_nx_openwindow.c
+CSRCS += lib_nx_raise.c lib_nx_setpixel.c lib_nx_setposition.c lib_nx_setsize.c
endif
# Add the nx/ directory to the build
diff --git a/nuttx/graphics/nxmu/nx_bitmap.c b/nuttx/libc/nx/lib_nx_bitmap.c
index a0bd748b0..fdd0b9717 100644
--- a/nuttx/graphics/nxmu/nx_bitmap.c
+++ b/nuttx/libc/nx/lib_nx_bitmap.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_bitmap.c
+ * libc/nx/lib_nx_bitmap.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,9 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-
-#include "nxbe.h"
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -106,7 +105,7 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
#ifdef CONFIG_DEBUG
if (!wnd || !dest || !src || !origin)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nx_fill.c b/nuttx/libc/nx/lib_nx_fill.c
index 969acdace..bc0307622 100644
--- a/nuttx/graphics/nxmu/nx_fill.c
+++ b/nuttx/libc/nx/lib_nx_fill.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_fill.c
+ * libc/nx/lib_nx_fill.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -45,8 +45,8 @@
#include <nuttx/nx/nxglib.h>
#include <nuttx/nx/nx.h>
-
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -97,7 +97,7 @@ int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
#ifdef CONFIG_DEBUG
if (!wnd || !rect || !color)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nx_filltrapezoid.c b/nuttx/libc/nx/lib_nx_filltrapezoid.c
index bf289179e..0d6b826ec 100644
--- a/nuttx/graphics/nxmu/nx_filltrapezoid.c
+++ b/nuttx/libc/nx/lib_nx_filltrapezoid.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_filltrapezoid.c
+ * libc/nx/lib_nx_filltrapezoid.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -45,8 +45,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -102,7 +102,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
#ifdef CONFIG_DEBUG
if (!wnd || !trap || !color)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nx_getposition.c b/nuttx/libc/nx/lib_nx_getposition.c
index 06ad2c6aa..4a0ae30b9 100644
--- a/nuttx/graphics/nxmu/nx_getposition.c
+++ b/nuttx/libc/nx/lib_nx_getposition.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_getposition.c
+ * libc/nx/lib_nx_getposition.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -93,7 +94,7 @@ int nx_getposition(NXWINDOW hwnd)
#ifdef CONFIG_DEBUG
if (!wnd)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nx_getrectangle.c b/nuttx/libc/nx/lib_nx_getrectangle.c
index fea01fcd2..e815e5a17 100644
--- a/nuttx/graphics/nxmu/nx_getrectangle.c
+++ b/nuttx/libc/nx/lib_nx_getrectangle.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_getrectangle.c
+ * libc/nx/lib_nx_getrectangle.c
*
- * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -44,8 +44,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
diff --git a/nuttx/graphics/nxmu/nx_lower.c b/nuttx/libc/nx/lib_nx_lower.c
index c9505ca49..64a8b5848 100644
--- a/nuttx/graphics/nxmu/nx_lower.c
+++ b/nuttx/libc/nx/lib_nx_lower.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_lower.c
+ * libc/nx/lib_nx_lower.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
diff --git a/nuttx/graphics/nxmu/nx_move.c b/nuttx/libc/nx/lib_nx_move.c
index c8d4d3dfd..30ab33259 100644
--- a/nuttx/graphics/nxmu/nx_move.c
+++ b/nuttx/libc/nx/lib_nx_move.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_move.c
+ * libc/nx/lib_nx_move.c
*
- * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -94,7 +95,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
#ifdef CONFIG_DEBUG
if (!wnd)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nx_openwindow.c b/nuttx/libc/nx/lib_nx_openwindow.c
index 2975e365a..a663b6493 100644
--- a/nuttx/graphics/nxmu/nx_openwindow.c
+++ b/nuttx/libc/nx/lib_nx_openwindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_openwindow.c
+ * libc/nx/lib_nx_openwindow.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,9 +43,10 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include <nuttx/kmalloc.h>
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
-#include "nxfe.h"
+#include "lib_internal.h"
/****************************************************************************
* Pre-Processor Definitions
@@ -97,17 +98,17 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
#ifdef CONFIG_DEBUG
if (!handle || !cb)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return NULL;
}
#endif
/* Pre-allocate the window structure */
- wnd = (FAR struct nxbe_window_s *)kzalloc(sizeof(struct nxbe_window_s));
+ wnd = (FAR struct nxbe_window_s *)lib_zalloc(sizeof(struct nxbe_window_s));
if (!wnd)
{
- errno = ENOMEM;
+ set_errno(ENOMEM);
return NULL;
}
diff --git a/nuttx/graphics/nxmu/nx_raise.c b/nuttx/libc/nx/lib_nx_raise.c
index 4f51810f1..6f35fc7cd 100644
--- a/nuttx/graphics/nxmu/nx_raise.c
+++ b/nuttx/libc/nx/lib_nx_raise.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_raise.c
+ * libc/nx/lib_nx_raise.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
diff --git a/nuttx/graphics/nxmu/nx_setpixel.c b/nuttx/libc/nx/lib_nx_setpixel.c
index 57fc12cc6..7712f034f 100644
--- a/nuttx/graphics/nxmu/nx_setpixel.c
+++ b/nuttx/libc/nx/lib_nx_setpixel.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_setpixel.c
+ * libc/nx/lib_nx_setpixel.c
*
- * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -45,8 +45,8 @@
#include <nuttx/nx/nxglib.h>
#include <nuttx/nx/nx.h>
-
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
diff --git a/nuttx/graphics/nxmu/nx_setposition.c b/nuttx/libc/nx/lib_nx_setposition.c
index 75b33757a..d83da41a7 100644
--- a/nuttx/graphics/nxmu/nx_setposition.c
+++ b/nuttx/libc/nx/lib_nx_setposition.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_setposition.c
+ * libc/nx/lib_nx_setposition.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -92,7 +93,7 @@ int nx_setposition(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos)
#ifdef CONFIG_DEBUG
if (!wnd || !pos)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nx_setsize.c b/nuttx/libc/nx/lib_nx_setsize.c
index 5f538bccc..860d5bd1e 100644
--- a/nuttx/graphics/nxmu/nx_setsize.c
+++ b/nuttx/libc/nx/lib_nx_setsize.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_setsize.c
+ * libc/nx/lib_nx_setsize.c
*
- * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,8 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -92,7 +93,7 @@ int nx_setsize(NXWINDOW hwnd, FAR const struct nxgl_size_s *size)
#ifdef CONFIG_DEBUG
if (!wnd || !size)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nxmu_semtake.c b/nuttx/libc/nx/lib_nxmu_semtake.c
index 164a099b8..2d5ad181d 100644
--- a/nuttx/graphics/nxmu/nxmu_semtake.c
+++ b/nuttx/libc/nx/lib_nxmu_semtake.c
@@ -1,7 +1,7 @@
/****************************************************************************
* graphics/nxmu/nxmu_semtake.c
*
- * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
diff --git a/nuttx/libc/nx/lib_nxmu_sendwindow.c b/nuttx/libc/nx/lib_nxmu_sendwindow.c
new file mode 100644
index 000000000..e7602005c
--- /dev/null
+++ b/nuttx/libc/nx/lib_nxmu_sendwindow.c
@@ -0,0 +1,115 @@
+/****************************************************************************
+ * libc/nx/lib_nxmu_sendserver.c
+ *
+ * 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
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <mqueue.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxmu_sendwindow
+ *
+ * Description:
+ * Send a message to the server destined for a specific window at
+ * NX_SVRMSG_PRIO priority
+ *
+ * Input Parameters:
+ * wnd - A pointer to the back-end window structure
+ * msg - A pointer to the message to send
+ * msglen - The length of the message in bytes.
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+
+int nxmu_sendwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
+ size_t msglen)
+{
+ int ret = OK;
+
+ /* Sanity checking */
+
+#ifdef CONFIG_DEBUG
+ if (!wnd || !wnd->conn)
+ {
+ set_errno(EINVAL);
+ return ERROR;
+ }
+#endif
+
+ /* Ignore messages destined to a blocked window (no errors reported) */
+
+ if (!NXBE_ISBLOCKED(wnd))
+ {
+ /* Send the message to the server */
+
+ ret = nxmu_sendserver(wnd->conn, msg, msglen);
+ }
+
+ return ret;
+}