summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-12-27 13:18:20 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-12-27 13:18:20 -0600
commit148213e1695902cbfaccc8599cfa06871b8133f3 (patch)
tree4785609fc85371d953d7323f8b7b32f130d969b8
parent020af6336bcf71173c7758f31b04066e425b4988 (diff)
downloadnuttx-148213e1695902cbfaccc8599cfa06871b8133f3.tar.gz
nuttx-148213e1695902cbfaccc8599cfa06871b8133f3.tar.bz2
nuttx-148213e1695902cbfaccc8599cfa06871b8133f3.zip
Decoupling NX user interfaces to support NX kernel build (phase 1)
-rw-r--r--nuttx/arch/arm/src/sam34/sam_userspace.c1
-rw-r--r--nuttx/graphics/nxbe/nxbe.h170
-rw-r--r--nuttx/graphics/nxmu/Make.defs28
-rw-r--r--nuttx/graphics/nxmu/nxfe.h501
-rw-r--r--nuttx/graphics/nxmu/nxmu_sendwindow.c2
-rw-r--r--nuttx/include/nuttx/nx/nxbe.h139
-rw-r--r--nuttx/include/nuttx/nx/nxmu.h554
-rw-r--r--nuttx/libc/Makefile1
-rw-r--r--nuttx/libc/audio/Make.defs2
-rw-r--r--nuttx/libc/lib_internal.h4
-rw-r--r--nuttx/libc/misc/lib_match.c2
-rw-r--r--nuttx/libc/nx/Make.defs55
-rw-r--r--nuttx/libc/nx/lib_nx_block.c (renamed from nuttx/graphics/nxmu/nx_block.c)10
-rw-r--r--nuttx/libc/nx/lib_nx_closewindow.c (renamed from nuttx/graphics/nxmu/nx_closewindow.c)9
-rw-r--r--nuttx/libc/nx/lib_nx_connect.c (renamed from nuttx/graphics/nxmu/nx_connect.c)15
-rw-r--r--nuttx/libc/nx/lib_nx_disconnect.c (renamed from nuttx/graphics/nxmu/nx_disconnect.c)7
-rw-r--r--nuttx/libc/nx/lib_nx_kbdchin.c (renamed from nuttx/graphics/nxmu/nx_kbdchin.c)6
-rw-r--r--nuttx/libc/nx/lib_nx_kbdin.c (renamed from nuttx/graphics/nxmu/nx_kbdin.c)14
-rw-r--r--nuttx/libc/nx/lib_nx_mousein.c (renamed from nuttx/graphics/nxmu/nx_mousein.c)6
-rw-r--r--nuttx/libc/nx/lib_nx_releasebkgd.c (renamed from nuttx/graphics/nxmu/nx_releasebkgd.c)10
-rw-r--r--nuttx/libc/nx/lib_nx_requestbkgd.c (renamed from nuttx/graphics/nxmu/nx_requestbkgd.c)9
-rw-r--r--nuttx/libc/nx/lib_nx_setbgcolor.c (renamed from nuttx/graphics/nxmu/nx_setbgcolor.c)8
-rw-r--r--nuttx/libc/nx/lib_nxmu_constructwindow.c (renamed from nuttx/graphics/nxmu/nxmu_constructwindow.c)18
-rw-r--r--nuttx/libc/nx/lib_nxmu_sendserver.c (renamed from nuttx/graphics/nxmu/nxmu_sendserver.c)6
24 files changed, 909 insertions, 668 deletions
diff --git a/nuttx/arch/arm/src/sam34/sam_userspace.c b/nuttx/arch/arm/src/sam34/sam_userspace.c
index 72f1a814b..7fd274be3 100644
--- a/nuttx/arch/arm/src/sam34/sam_userspace.c
+++ b/nuttx/arch/arm/src/sam34/sam_userspace.c
@@ -44,6 +44,7 @@
#include <nuttx/userspace.h>
+#include "sam_mpuinit.h"
#include "sam_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL
diff --git a/nuttx/graphics/nxbe/nxbe.h b/nuttx/graphics/nxbe/nxbe.h
index 34841ec03..e1bd714e7 100644
--- a/nuttx/graphics/nxbe/nxbe.h
+++ b/nuttx/graphics/nxbe/nxbe.h
@@ -1,7 +1,7 @@
/****************************************************************************
* graphics/nxbe/nxbe.h
*
- * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -47,22 +47,12 @@
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxglib.h>
+#include <nuttx/nx/nxbe.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
-/* Configuration ************************************************************/
-
-#ifndef CONFIG_NX_NPLANES
-# define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */
-#endif
-
-#ifndef CONFIG_NX_NCOLORS
-# define CONFIG_NX_NCOLORS 256
-#endif
-
-/* NXBE Definitions *********************************************************/
/* These are the values for the clipping order provided to nx_clipper */
#define NX_CLIPORDER_TLRB (0) /* Top-left-right-bottom */
@@ -71,14 +61,6 @@
#define NX_CLIPORDER_BRLT (3) /* Bottom-right-left-top */
#define NX_CLIPORDER_DEFAULT NX_CLIPORDER_TLRB
-/* Window flags and helper macros */
-
-#define NXBE_WINDOW_BLOCKED (1 << 0) /* The window is blocked and will not
- * receive further input. */
-
-#define NXBE_ISBLOCKED(wnd) (((wnd)->flags & NXBE_WINDOW_BLOCKED) != 0)
-#define NXBE_SETBLOCKED(wnd) do { (wnd)->flags |= NXBE_WINDOW_BLOCKED; } while (0)
-
/****************************************************************************
* Public Types
****************************************************************************/
@@ -137,46 +119,6 @@ struct nxbe_clipops_s
FAR const struct nxgl_rect_s *rect);
};
-/* Windows ******************************************************************/
-
-/* This structure represents one window. */
-
-struct nxbe_state_s;
-struct nxfe_conn_s;
-struct nxbe_window_s
-{
- /* State information */
-
- FAR struct nxbe_state_s *be; /* The back-end state structure */
-#ifdef CONFIG_NX_MULTIUSER
- FAR struct nxfe_conn_s *conn; /* Connection to the window client */
-#endif
- FAR const struct nx_callback_s *cb; /* Event handling callbacks */
-
- /* The following links provide the window's vertical position using a
- * singly linked list.
- */
-
- FAR struct nxbe_window_s *above; /* The window "above" this window */
- FAR struct nxbe_window_s *below; /* The window "below this one */
-
- /* Window geometry. The window is described by a rectangle in the
- * absolute screen coordinate system (0,0)->(xres,yres)
- */
-
- struct nxgl_rect_s bounds; /* The bounding rectangle of window */
-
- /* Window flags (see the NXBE_* bit definitions above) */
-
-#ifdef CONFIG_NX_MULTIUSER /* Currently used only in multi-user mode */
- uint8_t flags;
-#endif
-
- /* Client state information this is provide in window callbacks */
-
- FAR void *arg;
-};
-
/* Back-end state ***********************************************************/
/* This structure describes the overall back-end window state */
@@ -228,12 +170,12 @@ extern "C" {
* Name: nxbe_colormap
*
* Description:
- * Set the harware color map to the palette expected by NX
+ * Set the hardware color map to the palette expected by NX
*
****************************************************************************/
#ifdef CONFIG_FB_CMAP
-EXTERN int nxbe_colormap(FAR NX_DRIVERTYPE *dev);
+int nxbe_colormap(FAR NX_DRIVERTYPE *dev);
#endif
/****************************************************************************
@@ -245,8 +187,7 @@ EXTERN int nxbe_colormap(FAR NX_DRIVERTYPE *dev);
*
****************************************************************************/
-EXTERN int nxbe_configure(FAR NX_DRIVERTYPE *dev,
- FAR struct nxbe_state_s *be);
+int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be);
/****************************************************************************
* Name: nxbe_closewindow
@@ -262,7 +203,7 @@ EXTERN int nxbe_configure(FAR NX_DRIVERTYPE *dev,
*
****************************************************************************/
-EXTERN void nxbe_closewindow(struct nxbe_window_s *wnd);
+void nxbe_closewindow(struct nxbe_window_s *wnd);
/****************************************************************************
* Name: nxbe_setposition
@@ -273,8 +214,8 @@ EXTERN void nxbe_closewindow(struct nxbe_window_s *wnd);
*
****************************************************************************/
-EXTERN void nxbe_setposition(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_point_s *pos);
+void nxbe_setposition(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_point_s *pos);
/****************************************************************************
* Name: nxbe_setsize
@@ -285,8 +226,8 @@ EXTERN void nxbe_setposition(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_setsize(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_size_s *size);
+void nxbe_setsize(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_size_s *size);
/****************************************************************************
* Name: nxbe_raise
@@ -296,7 +237,7 @@ EXTERN void nxbe_setsize(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_raise(FAR struct nxbe_window_s *wnd);
+void nxbe_raise(FAR struct nxbe_window_s *wnd);
/****************************************************************************
* Name: nxbe_lower
@@ -306,7 +247,7 @@ EXTERN void nxbe_raise(FAR struct nxbe_window_s *wnd);
*
****************************************************************************/
-EXTERN void nxbe_lower(FAR struct nxbe_window_s *wnd);
+void nxbe_lower(FAR struct nxbe_window_s *wnd);
/****************************************************************************
* Name: nxbe_setpixel
@@ -325,9 +266,9 @@ EXTERN void nxbe_lower(FAR struct nxbe_window_s *wnd);
*
****************************************************************************/
-EXTERN void nxbe_setpixel(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_point_s *pos,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+void nxbe_setpixel(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_point_s *pos,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
/****************************************************************************
* Name: nxbe_fill
@@ -345,9 +286,9 @@ EXTERN void nxbe_setpixel(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_fill(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *rect,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+void nxbe_fill(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *rect,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
/****************************************************************************
* Name: nxbe_filltrapezoid
@@ -366,10 +307,10 @@ EXTERN void nxbe_fill(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *clip,
- FAR const struct nxgl_trapezoid_s *trap,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *clip,
+ FAR const struct nxgl_trapezoid_s *trap,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
/****************************************************************************
* Name: nxbe_getrectangle
@@ -392,10 +333,10 @@ EXTERN void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *rect,
- unsigned int plane,
- FAR uint8_t *dest, unsigned int deststride);
+void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *rect,
+ unsigned int plane,
+ FAR uint8_t *dest, unsigned int deststride);
/****************************************************************************
* Name: nxbe_move
@@ -413,9 +354,9 @@ EXTERN void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_move(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *rect,
- FAR const struct nxgl_point_s *offset);
+void nxbe_move(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *rect,
+ FAR const struct nxgl_point_s *offset);
/****************************************************************************
* Name: nxbe_bitmap
@@ -439,29 +380,29 @@ EXTERN void nxbe_move(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *dest,
- FAR const void *src[CONFIG_NX_NPLANES],
- FAR const struct nxgl_point_s *origin,
- unsigned int stride);
+void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *dest,
+ FAR const void *src[CONFIG_NX_NPLANES],
+ FAR const struct nxgl_point_s *origin,
+ unsigned int stride);
/****************************************************************************
* Name: nxbe_redraw
*
- * Descripton:
+ * Description:
* Re-draw the visible portions of the rectangular region for the
* specified window
*
****************************************************************************/
-EXTERN void nxbe_redraw(FAR struct nxbe_state_s *be,
- FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *rect);
+void nxbe_redraw(FAR struct nxbe_state_s *be,
+ FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *rect);
/****************************************************************************
* Name: nxbe_redrawbelow
*
- * Descripton:
+ * Description:
* Re-draw the visible portions of the rectangular region for all windows
* below (and including) the specified window. This function is called
* whenever a window is closed, moved, lowered or re-sized in order to
@@ -469,28 +410,28 @@ EXTERN void nxbe_redraw(FAR struct nxbe_state_s *be,
*
****************************************************************************/
-EXTERN void nxbe_redrawbelow(FAR struct nxbe_state_s *be,
- FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *rect);
+void nxbe_redrawbelow(FAR struct nxbe_state_s *be,
+ FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *rect);
/****************************************************************************
* Name: nxbe_visible
*
- * Descripton:
+ * Description:
* Return true if the point, pt, in window wnd is visible. pt is in
* absolute screen coordinates
*
****************************************************************************/
-EXTERN bool nxbe_visible(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_point_s *pos);
+bool nxbe_visible(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_point_s *pos);
/****************************************************************************
* Name: nxbe_clipper
*
- * Descripton:
+ * Description:
* Perform flexible clipping operations. Callbacks are executed for
- * each oscured and visible portions of the window.
+ * each obscured and visible portions of the window.
*
* Input Parameters:
* wnd - The window to be clipped.
@@ -507,22 +448,22 @@ EXTERN bool nxbe_visible(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
-EXTERN void nxbe_clipper(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *dest, uint8_t order,
- FAR struct nxbe_clipops_s *cops,
- FAR struct nxbe_plane_s *plane);
+void nxbe_clipper(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *dest, uint8_t order,
+ FAR struct nxbe_clipops_s *cops,
+ FAR struct nxbe_plane_s *plane);
/****************************************************************************
* Name: nxbe_clipnull
*
- * Descripton:
+ * Description:
* The do-nothing clipping callback function
*
****************************************************************************/
-EXTERN void nxbe_clipnull(FAR struct nxbe_clipops_s *cops,
- FAR struct nxbe_plane_s *plane,
- FAR const struct nxgl_rect_s *rect);
+void nxbe_clipnull(FAR struct nxbe_clipops_s *cops,
+ FAR struct nxbe_plane_s *plane,
+ FAR const struct nxgl_rect_s *rect);
#undef EXTERN
#if defined(__cplusplus)
@@ -530,4 +471,3 @@ EXTERN void nxbe_clipnull(FAR struct nxbe_clipops_s *cops,
#endif
#endif /* __GRAPHICS_NXBE_NXBE_H */
-
diff --git a/nuttx/graphics/nxmu/Make.defs b/nuttx/graphics/nxmu/Make.defs
index 23bf8995b..8c75ad6e1 100644
--- a/nuttx/graphics/nxmu/Make.defs
+++ b/nuttx/graphics/nxmu/Make.defs
@@ -1,7 +1,7 @@
############################################################################
# graphics/nxmu/Make.defs
#
-# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2011-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -33,16 +33,16 @@
#
############################################################################
-NX_ASRCS =
-NXAPI_CSRCS = nx_bitmap.c nx_closewindow.c nx_connect.c nx_disconnect.c \
- nx_eventhandler.c nx_eventnotify.c nx_fill.c nx_filltrapezoid.c \
- nx_getposition.c nx_getrectangle.c nx_kbdchin.c nx_kbdin.c nx_lower.c \
- nx_mousein.c nx_move.c nx_openwindow.c nx_raise.c \
- nx_releasebkgd.c nx_requestbkgd.c nx_setpixel.c nx_setsize.c \
- nx_setbgcolor.c nx_setposition.c nx_drawcircle.c nx_drawline.c \
- nx_fillcircle.c nx_block.c
-NXMU_CSRCS = nxmu_constructwindow.c nxmu_kbdin.c nxmu_mouse.c \
- nxmu_openwindow.c nxmu_redrawreq.c nxmu_releasebkgd.c \
- nxmu_requestbkgd.c nxmu_reportposition.c nxmu_sendclient.c \
- nxmu_sendserver.c nxmu_sendwindow.c nxmu_semtake.c nxmu_server.c
-NX_CSRCS = $(NXAPI_CSRCS) $(NXMU_CSRCS)
+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
+
+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
+
+NX_CSRCS = $(NXAPI_CSRCS) $(NXMU_CSRCS)
diff --git a/nuttx/graphics/nxmu/nxfe.h b/nuttx/graphics/nxmu/nxfe.h
index e24b44af7..a455f478d 100644
--- a/nuttx/graphics/nxmu/nxfe.h
+++ b/nuttx/graphics/nxmu/nxfe.h
@@ -1,7 +1,7 @@
/****************************************************************************
* graphics/nxmu/nxfe.h
*
- * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -48,36 +48,13 @@
#include <semaphore.h>
#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxmu.h>
#include "nxbe.h"
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
-
-/* Configuration ************************************************************/
-
-#ifdef CONFIG_DISABLE_MQUEUE
-# error "Message queues are disabled(CONFIG_DISABLE_MQUEUE)"
-#endif
-
-#ifndef CONFIG_NX_MXSERVERMSGS
-# define CONFIG_NX_MXSERVERMSGS 32 /* Number of pending messages in server MQ */
-#endif
-
-#ifndef CONFIG_NX_MXCLIENTMSGS
-# define CONFIG_NX_MXCLIENTMSGS 16 /* Number of pending messages in each client MQ */
-#endif
-
-/* Used to create unique client MQ name */
-
-#define NX_CLIENT_MQNAMEFMT "/dev/nxc%d"
-#define NX_CLIENT_MXNAMELEN (16)
-
-#define NX_MXSVRMSGLEN (64) /* Maximum size of a client->server command */
-#define NX_MXEVENTLEN (64) /* Maximum size of an event */
-#define NX_MXCLIMSGLEN (64) /* Maximum size of a server->client message */
-
/* Handy macros */
#define nxmu_semgive(sem) sem_post(sem) /* To match nxmu_semtake() */
@@ -86,36 +63,6 @@
* Public Types
****************************************************************************/
-/* Client/Connection structures *********************************************/
-
-/* Client state */
-
-enum nx_clistate_e
-{
- NX_CLISTATE_NOTCONNECTED = 0, /* Waiting for server to acknowledge connection */
- NX_CLISTATE_CONNECTED, /* Connection established (normal state) */
- NX_CLISTATE_DISCONNECT_PENDING, /* Waiting for server to acknowledge disconnect */
-};
-
-/* This structure represents a connection between the client and the server */
-
-struct nxfe_conn_s
-{
- /* This number uniquely identifies the client */
-
- int cid; /* Client ID (CID) */
- uint8_t state; /* See enum nx_clistate_e */
-
- /* These are only usable on the client side of the connection */
-
- mqd_t crdmq; /* MQ to read from the server (may be non-blocking) */
- mqd_t cwrmq; /* MQ to write to the server (blocking) */
-
- /* These are only usable on the server side of the connection */
-
- mqd_t swrmq; /* MQ to write to the client */
-};
-
/* Server state structure ***************************************************/
/* This the server 'front-end' state structure */
@@ -129,342 +76,11 @@ struct nxfe_state_s
struct nxbe_state_s be;
- /* This is the server's connection to iself */
+ /* This is the server's connection to itself */
struct nxfe_conn_s conn;
};
-/* Message IDs **************************************************************/
-
-enum nxmsg_e
-{
- /* Server-to-Client Messages **********************************************/
-
- NX_CLIMSG_CONNECTED = 1, /* The server has completed the connection and is ready */
- NX_CLIMSG_DISCONNECTED, /* The server has disconnected */
- NX_CLIMSG_REDRAW, /* Re-draw the specified window */
- NX_CLIMSG_NEWPOSITION, /* New window size/position */
- NX_CLIMSG_MOUSEIN, /* New mouse positional data available for window */
- NX_CLIMSG_KBDIN, /* New keypad input available for window */
- NX_CLIMSG_BLOCKED, /* The window is blocked */
-
- /* Client-to-Server Messages **********************************************/
-
- NX_SVRMSG_CONNECT, /* Establish connection with new NX server client */
- NX_SVRMSG_DISCONNECT, /* Tear down connection with terminating client */
- NX_SVRMSG_OPENWINDOW, /* Create a new window */
- NX_SVRMSG_CLOSEWINDOW, /* Close an existing window */
- NX_SVRMSG_BLOCKED, /* The window is blocked */
- NX_SVRMSG_REQUESTBKGD, /* Open the background window */
- NX_SVRMSG_RELEASEBKGD, /* Release the background window */
- NX_SVRMSG_SETPOSITION, /* Window position has changed */
- NX_SVRMSG_SETSIZE, /* Window size has changed */
- NX_SVRMSG_GETPOSITION, /* Get the current window position and size */
- NX_SVRMSG_RAISE, /* Move the window to the top */
- NX_SVRMSG_LOWER, /* Move the window to the bottom */
- NX_SVRMSG_SETPIXEL, /* Set a single pixel in the window with a color */
- NX_SVRMSG_FILL, /* Fill a rectangle in the window with a color */
- NX_SVRMSG_GETRECTANGLE, /* Get a rectangular region in the window */
- NX_SVRMSG_FILLTRAP, /* Fill a trapezoidal region in the window with a color */
- NX_SVRMSG_MOVE, /* Move a rectangular region within the window */
- NX_SVRMSG_BITMAP, /* Copy a rectangular bitmap into the window */
- NX_SVRMSG_SETBGCOLOR, /* Set the color of the background */
- NX_SVRMSG_MOUSEIN, /* New mouse report from mouse client */
- NX_SVRMSG_KBDIN, /* New keyboard report from keyboard client */
-};
-
-/* Message priorities -- they must all be at the same priority to assure
- * FIFO execution.
- */
-
-#define NX_CLIMSG_PRIO 42
-#define NX_SVRMSG_PRIO 42
-
-/* Server-to-Client Message Structures **************************************/
-
-/* The generic message structure. All messages begin with this form. */
-
-struct nxclimsg_s
-{
- uint32_t msgid; /* Any of nxclimsg_e */
-};
-
-/* The server is now connected */
-
-struct nxclimsg_connected_s
-{
- uint32_t msgid; /* NX_CLIMSG_REDRAW_CONNECTED */
-};
-
-/* The server is now disconnected */
-
-struct nxclimsg_disconnected_s
-{
- uint32_t msgid; /* NX_CLIMSG_REDRAW_DISCONNECTED */
-};
-
-/* This message is received when a requested window has been opened. If wnd is NULL
- * then errorcode is the errno value that provides the explanation of the error.
- */
-
-struct nxclimsg_redraw_s
-{
- uint32_t msgid; /* NX_CLIMSG_REDRAW */
- FAR struct nxbe_window_s *wnd; /* The handle to the window to redraw in */
- FAR struct nxgl_rect_s rect; /* The rectangle to be redrawn */
- bool more; /* true: more redraw messages follow */
-};
-
-/* This message informs the client of the new size or position of the window */
-
-struct nxclimsg_newposition_s
-{
- uint32_t msgid; /* NX_CLIMSG_NEWPOSITION */
- FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
- FAR struct nxgl_size_s size; /* The current window size */
- FAR struct nxgl_point_s pos; /* The current window position */
- FAR struct nxgl_rect_s bounds; /* Size of screen */
-};
-
-/* This message reports a new mouse event to a particular window */
-
-#ifdef CONFIG_NX_MOUSE
-struct nxclimsg_mousein_s
-{
- uint32_t msgid; /* NX_SVRMSG_MOUSEIN */
- FAR struct nxbe_window_s *wnd; /* The handle of window receiving mouse input */
- struct nxgl_point_s pos; /* Mouse X/Y position */
- uint8_t buttons; /* Mouse button set */
-};
-#endif
-
-/* This message reports a new keypad event to a particular window */
-
-#ifdef CONFIG_NX_KBD
-struct nxclimsg_kbdin_s
-{
- uint32_t msgid; /* NX_CLIMSG_KBDIN */
- FAR struct nxbe_window_s *wnd; /* The handle of window receiving keypad input */
- uint8_t nch; /* Number of characters received */
- uint8_t ch[1]; /* Array of received characters */
-};
-#endif
-
-/* This messsage confirms that that all queued window messages have been
- * flushed and that the all further window messages are blocked.
- */
-
-struct nxclimsg_blocked_s
-{
- uint32_t msgid; /* NX_CLIMSG_BLOCKED */
- FAR struct nxbe_window_s *wnd; /* The window that is blocked */
- FAR void *arg; /* User argument */
-};
-
-/* Client-to-Server Message Structures **************************************/
-
-/* The generic message structure. All server messages begin with this form. Also
- * messages that have no additional data fields use this structure. This includes:
- * NX_SVRMSG_CONNECT and NX_SVRMSG_DISCONNECT.
- */
-
-struct nxsvrmsg_s /* Generic server message */
-{
- uint32_t msgid; /* One of enum nxsvrmsg_e */
- FAR struct nxfe_conn_s *conn; /* The specific connection sending the message */
-};
-
-/* This message requests the server to create a new window */
-
-struct nxsvrmsg_openwindow_s
-{
- uint32_t msgid; /* NX_SVRMSG_OPENWINDOW */
- FAR struct nxbe_window_s *wnd; /* The pre-allocated window structure */
-};
-
-/* This message informs the server that client wishes to close a window */
-
-struct nxsvrmsg_closewindow_s
-{
- uint32_t msgid; /* NX_SVRMSG_CLOSEWINDOW */
- FAR struct nxbe_window_s *wnd; /* The window to be closed */
-};
-
-/* This messsage is just a marker that is queued and forwarded by the server
- * (NX_CLIMSG_BLOCKED). Messages to the window were blocked just after this
- * message was sent. Receipt of this message indicates both that the window
- * blocked and that there are no further queued messages for the window.
- */
-
-struct nxsvrmsg_blocked_s
-{
- uint32_t msgid; /* NX_SVRMSG_BLOCKED */
- FAR struct nxbe_window_s *wnd; /* The window that is blocked */
- FAR void *arg; /* User argument */
-};
-
-/* This message requests the server to create a new window */
-
-struct nxsvrmsg_requestbkgd_s
-{
- uint32_t msgid; /* NX_SVRMSG_REQUESTBKGD */
- FAR struct nxfe_conn_s *conn; /* The specific connection sending the message */
- FAR const struct nx_callback_s *cb; /* Event handling callbacks */
- FAR void *arg; /* Client argument used with callbacks */
-};
-
-/* This message informs the server that client wishes to close a window */
-
-struct nxsvrmsg_releasebkgd_s
-{
- uint32_t msgid; /* NX_SVRMSG_RELEASEBKGD */
-};
-
-/* This message informs the server that the size or position of the window has changed */
-
-struct nxsvrmsg_setposition_s
-{
- uint32_t msgid; /* NX_SVRMSG_SETPOSITION */
- FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
- FAR struct nxgl_point_s pos; /* The new window position */
-};
-
-/* This message informs the server that the size or position of the window has changed */
-
-struct nxsvrmsg_setsize_s
-{
- uint32_t msgid; /* NX_SVRMSG_SETSIZE */
- FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
- FAR struct nxgl_size_s size; /* The new window size */
-};
-
-/* This message informs the server that the size or position of the window has changed */
-
-struct nxsvrmsg_getposition_s
-{
- uint32_t msgid; /* NX_SVRMSG_FETPOSITION */
- FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
-};
-
-/* This message informs the server to raise this window to the top of the display */
-
-struct nxsvrmsg_raise_s
-{
- uint32_t msgid; /* NX_SVRMSG_RAISE */
- FAR struct nxbe_window_s *wnd; /* The window to be raised */
-};
-
-/* This message informs the server to lower this window to the bottom of the display */
-
-struct nxsvrmsg_lower_s
-{
- uint32_t msgid; /* NX_SVRMSG_LOWER */
- FAR struct nxbe_window_s *wnd; /* The window to be lowered */
-};
-
-/* Set a single pixel in the window with a color */
-
-struct nxsvrmsg_setpixel_s
-{
- uint32_t msgid; /* NX_SVRMSG_SETPIXEL */
- FAR struct nxbe_window_s *wnd; /* The window to fill */
- struct nxgl_point_s pos; /* The position of the pixel in the window */
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
-};
-
-/* Fill a rectangle in the window with a color */
-
-struct nxsvrmsg_fill_s
-{
- uint32_t msgid; /* NX_SVRMSG_FILL */
- FAR struct nxbe_window_s *wnd; /* The window to fill */
- struct nxgl_rect_s rect; /* The rectangle in the window to fill */
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
-};
-
-/* Get a rectangular region from the window */
-
-struct nxsvrmsg_getrectangle_s
-{
- uint32_t msgid; /* NX_SVRMSG_GETRECTANGLE */
- FAR struct nxbe_window_s *wnd; /* The window to get from */
- struct nxgl_rect_s rect; /* The rectangle in the window to get from */
- unsigned int plane; /* The plane number to read */
- FAR uint8_t *dest; /* Memory location in which to store the graphics data */
- unsigned int deststride; /* Width of the destination memory in bytes */
- sem_t *sem_done; /* Semaphore to report when command is done. */
-};
-
-/* Fill a trapezoidal region in the window with a color */
-
-struct nxsvrmsg_filltrapezoid_s
-{
- uint32_t msgid; /* NX_SVRMSG_FILLTRAP */
- FAR struct nxbe_window_s *wnd; /* The window to fill */
- FAR struct nxgl_rect_s clip; /* The clipping window */
- struct nxgl_trapezoid_s trap; /* The trapezoidal region in the window to fill */
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
-};
-
-/* Move a rectangular region within the window */
-
-struct nxsvrmsg_move_s
-{
- uint32_t msgid; /* NX_SVRMSG_MOVE */
- FAR struct nxbe_window_s *wnd; /* The window within which the move is done */
- struct nxgl_rect_s rect; /* Describes the rectangular region to move */
- struct nxgl_point_s offset; /* The offset to move the region */
-};
-
-/* Copy a rectangular bitmap into the window */
-
-struct nxsvrmsg_bitmap_s
-{
- uint32_t msgid; /* NX_SVRMSG_BITMAP */
- FAR struct nxbe_window_s *wnd; /* The window with will receive the bitmap image */
- struct nxgl_rect_s dest; /* Destination location of the bitmap in the window */
- FAR const void *src[CONFIG_NX_NPLANES]; /* The start of the source image. */
- struct nxgl_point_s origin; /* Offset into the source image data */
- unsigned int stride; /* The width of the full source image in pixels. */
- sem_t *sem_done; /* Semaphore to report when command is done. */
-};
-
-/* Set the color of the background */
-
-struct nxsvrmsg_setbgcolor_s
-{
- uint32_t msgid; /* NX_SVRMSG_SETBGCOLOR */
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the background */
-};
-
-/* This message reports a new mouse event from a hardware controller attached to
- * the server as a regular client (this message may have even been sent from an
- * interrupt handler).
- */
-
-#ifdef CONFIG_NX_MOUSE
-struct nxsvrmsg_mousein_s
-{
- uint32_t msgid; /* NX_SVRMSG_MOUSEIN */
- struct nxgl_point_s pt; /* Mouse X/Y position */
- uint8_t buttons; /* Mouse button set */
-};
-#endif
-
-/* This message reports a new keyboard event from a hardware controller attached to
- * some kind of keypad (this message may have even been sent from an
- * interrupt handler).
- */
-
-#ifdef CONFIG_NX_KBD
-struct nxsvrmsg_kbdin_s
-{
- uint32_t msgid; /* NX_SVRMSG_KBDIN */
- uint8_t nch ; /* Number of characters received */
- uint8_t ch[1]; /* Array of received characters */
-};
-#endif
-
/****************************************************************************
* Public Data
****************************************************************************/
@@ -472,7 +88,8 @@ struct nxsvrmsg_kbdin_s
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
@@ -505,69 +122,14 @@ extern "C" {
*
* Return:
* OK on success; ERROR on failure with errno set appropriately. In the
- * case of ERROR, NX will have dealloated the pre-allocated window.
- *
- ****************************************************************************/
-
-EXTERN int nxfe_constructwindow(NXHANDLE handle,
- FAR struct nxbe_window_s *wnd,
- FAR const struct nx_callback_s *cb,
- FAR void *arg);
-
-/****************************************************************************
- * Name: nxmu_semtake
- *
- * Description:
- * Take the semaphore, handling EINTR wakeups. See the nxmu_semgive macro.
- *
- * Input Parameters:
- * sem - the semaphore to be taken.
- *
- * Return:
- * None
- *
- ****************************************************************************/
-
-EXTERN void nxmu_semtake(sem_t *sem);
-
-/****************************************************************************
- * Name: nxmu_sendserver
- *
- * Description:
- * Send a message to the server at NX_SVRMSG_PRIO priority
- *
- * Input Parameters:
- * conn - A pointer to the server connection 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
+ * case of ERROR, NX will have deallocated the pre-allocated window.
*
****************************************************************************/
-EXTERN int nxmu_sendserver(FAR struct nxfe_conn_s *conn,
- FAR const void *msg, size_t msglen);
-
-/****************************************************************************
- * Name: nxmu_sendwindow
- *
- * Description:
- * Send a message to the server detined 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
- *
- ****************************************************************************/
-
-EXTERN int nxmu_sendwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
- size_t msglen);
+int nxfe_constructwindow(NXHANDLE handle,
+ FAR struct nxbe_window_s *wnd,
+ FAR const struct nx_callback_s *cb,
+ FAR void *arg);
/****************************************************************************
* Name: nxmu_sendclient
@@ -585,8 +147,8 @@ EXTERN int nxmu_sendwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
*
****************************************************************************/
-EXTERN int nxmu_sendclient(FAR struct nxfe_conn_s *conn,
- FAR const void *msg, size_t msglen);
+int nxmu_sendclient(FAR struct nxfe_conn_s *conn,
+ FAR const void *msg, size_t msglen);
/****************************************************************************
* Name: nxmu_sendclientwindow
@@ -605,7 +167,7 @@ EXTERN int nxmu_sendclient(FAR struct nxfe_conn_s *conn,
****************************************************************************/
int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
- size_t msglen);
+ size_t msglen);
/****************************************************************************
* Name: nxmu_openwindow
@@ -622,8 +184,8 @@ int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
*
****************************************************************************/
-EXTERN void nxmu_openwindow(FAR struct nxbe_state_s *be,
- FAR struct nxbe_window_s *wnd);
+void nxmu_openwindow(FAR struct nxbe_state_s *be,
+ FAR struct nxbe_window_s *wnd);
/****************************************************************************
* Name: nxmu_requestbkgd
@@ -643,10 +205,10 @@ EXTERN void nxmu_openwindow(FAR struct nxbe_state_s *be,
*
****************************************************************************/
-EXTERN void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn,
- FAR struct nxbe_state_s *be,
- FAR const struct nx_callback_s *cb,
- FAR void *arg);
+void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn,
+ FAR struct nxbe_state_s *be,
+ FAR const struct nx_callback_s *cb,
+ FAR void *arg);
/****************************************************************************
* Name: nxmu_releasebkgd
@@ -663,28 +225,28 @@ EXTERN void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn,
*
****************************************************************************/
-EXTERN void nxmu_releasebkgd(FAR struct nxfe_state_s *fe);
+void nxmu_releasebkgd(FAR struct nxfe_state_s *fe);
/****************************************************************************
* Name: nxfe_reportposition
*
- * Descripton:
+ * Description:
* Report the new size/position of the window.
*
****************************************************************************/
-EXTERN void nxfe_reportposition(FAR struct nxbe_window_s *wnd);
+void nxfe_reportposition(FAR struct nxbe_window_s *wnd);
/****************************************************************************
* Name: nxfe_redrawreq
*
- * Descripton:
+ * Description:
* Request the client that has this window to redraw the rectangular region.
*
****************************************************************************/
-EXTERN void nxfe_redrawreq(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *rect);
+void nxfe_redrawreq(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *rect);
/****************************************************************************
* Name: nxmu_mouseinit
@@ -695,7 +257,7 @@ EXTERN void nxfe_redrawreq(FAR struct nxbe_window_s *wnd,
****************************************************************************/
#ifdef CONFIG_NX_MOUSE
-EXTERN void nxmu_mouseinit(int x, int y);
+void nxmu_mouseinit(int x, int y);
#endif
/****************************************************************************
@@ -713,7 +275,7 @@ EXTERN void nxmu_mouseinit(int x, int y);
****************************************************************************/
#ifdef CONFIG_NX_MOUSE
-EXTERN int nxmu_mousereport(struct nxbe_window_s *wnd);
+int nxmu_mousereport(struct nxbe_window_s *wnd);
#endif
/****************************************************************************
@@ -727,14 +289,14 @@ EXTERN int nxmu_mousereport(struct nxbe_window_s *wnd);
****************************************************************************/
#ifdef CONFIG_NX_MOUSE
-EXTERN int nxmu_mousein(FAR struct nxfe_state_s *fe,
- FAR const struct nxgl_point_s *pos, int button);
+int nxmu_mousein(FAR struct nxfe_state_s *fe,
+ FAR const struct nxgl_point_s *pos, int button);
#endif
/****************************************************************************
* Name: nxmu_kbdin
*
- * Descripton:
+ * Description:
* New keyboard data has been received from the thread or interrupt
* handler that manages some kind of keyboard/keypad hardware. Route that
* positional data to the appropriate window client.
@@ -742,7 +304,7 @@ EXTERN int nxmu_mousein(FAR struct nxfe_state_s *fe,
****************************************************************************/
#ifdef CONFIG_NX_KBD
-EXTERN void nxmu_kbdin(FAR struct nxfe_state_s *fe, uint8_t nch, FAR uint8_t *ch);
+void nxmu_kbdin(FAR struct nxfe_state_s *fe, uint8_t nch, FAR uint8_t *ch);
#endif
#undef EXTERN
@@ -751,4 +313,3 @@ EXTERN void nxmu_kbdin(FAR struct nxfe_state_s *fe, uint8_t nch, FAR uint8_t *ch
#endif
#endif /* __GRAPHICS_NXMU_NXFE_H */
-
diff --git a/nuttx/graphics/nxmu/nxmu_sendwindow.c b/nuttx/graphics/nxmu/nxmu_sendwindow.c
index 0826a45bc..57fdd6b77 100644
--- a/nuttx/graphics/nxmu/nxmu_sendwindow.c
+++ b/nuttx/graphics/nxmu/nxmu_sendwindow.c
@@ -73,7 +73,7 @@
* Name: nxmu_sendwindow
*
* Description:
- * Send a message to the server detined for a specific window at
+ * Send a message to the server destined for a specific window at
* NX_SVRMSG_PRIO priority
*
* Input Parameters:
diff --git a/nuttx/include/nuttx/nx/nxbe.h b/nuttx/include/nuttx/nx/nxbe.h
new file mode 100644
index 000000000..785cb2d3d
--- /dev/null
+++ b/nuttx/include/nuttx/nx/nxbe.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+ * include/nuttx/nx/nxbe.h
+ *
+ * Copyright (C) 2008-2011, 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.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_NX_NXBE_H
+#define __INCLUDE_NUTTX_NX_NXBE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_NX_NPLANES
+# define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */
+#endif
+
+#ifndef CONFIG_NX_NCOLORS
+# define CONFIG_NX_NCOLORS 256
+#endif
+
+/* NXBE Definitions *********************************************************/
+/* Window flags and helper macros */
+
+#define NXBE_WINDOW_BLOCKED (1 << 0) /* The window is blocked and will not
+ * receive further input. */
+
+#define NXBE_ISBLOCKED(wnd) (((wnd)->flags & NXBE_WINDOW_BLOCKED) != 0)
+#define NXBE_SETBLOCKED(wnd) do { (wnd)->flags |= NXBE_WINDOW_BLOCKED; } while (0)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* Windows ******************************************************************/
+
+/* This structure represents one window. */
+
+struct nxbe_state_s;
+struct nxfe_conn_s;
+struct nxbe_window_s
+{
+ /* State information */
+
+ FAR struct nxbe_state_s *be; /* The back-end state structure */
+#ifdef CONFIG_NX_MULTIUSER
+ FAR struct nxfe_conn_s *conn; /* Connection to the window client */
+#endif
+ FAR const struct nx_callback_s *cb; /* Event handling callbacks */
+
+ /* The following links provide the window's vertical position using a
+ * singly linked list.
+ */
+
+ FAR struct nxbe_window_s *above; /* The window "above" this window */
+ FAR struct nxbe_window_s *below; /* The window "below this one */
+
+ /* Window geometry. The window is described by a rectangle in the
+ * absolute screen coordinate system (0,0)->(xres,yres)
+ */
+
+ struct nxgl_rect_s bounds; /* The bounding rectangle of window */
+
+ /* Window flags (see the NXBE_* bit definitions above) */
+
+#ifdef CONFIG_NX_MULTIUSER /* Currently used only in multi-user mode */
+ uint8_t flags;
+#endif
+
+ /* Client state information this is provide in window callbacks */
+
+ FAR void *arg;
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __INCLUDE_NUTTX_NX_NXBE_H */
+
diff --git a/nuttx/include/nuttx/nx/nxmu.h b/nuttx/include/nuttx/nx/nxmu.h
new file mode 100644
index 000000000..55c33c612
--- /dev/null
+++ b/nuttx/include/nuttx/nx/nxmu.h
@@ -0,0 +1,554 @@
+/****************************************************************************
+ * include/nuttx/nx/nxmu.h
+ *
+ * Copyright (C) 2008-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.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_NX_NXMU_H
+#define __INCLUDE_NUTTX_NX_NXMU_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <mqueue.h>
+#include <semaphore.h>
+
+#include <nuttx/nx/nx.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifdef CONFIG_DISABLE_MQUEUE
+# error "Message queues are disabled(CONFIG_DISABLE_MQUEUE)"
+#endif
+
+#ifndef CONFIG_NX_MXSERVERMSGS
+# define CONFIG_NX_MXSERVERMSGS 32 /* Number of pending messages in server MQ */
+#endif
+
+#ifndef CONFIG_NX_MXCLIENTMSGS
+# define CONFIG_NX_MXCLIENTMSGS 16 /* Number of pending messages in each client MQ */
+#endif
+
+/* Used to create unique client MQ name */
+
+#define NX_CLIENT_MQNAMEFMT "/dev/nxc%d"
+#define NX_CLIENT_MXNAMELEN (16)
+
+#define NX_MXSVRMSGLEN (64) /* Maximum size of a client->server command */
+#define NX_MXEVENTLEN (64) /* Maximum size of an event */
+#define NX_MXCLIMSGLEN (64) /* Maximum size of a server->client message */
+
+/* Message priorities -- they must all be at the same priority to assure
+ * FIFO execution.
+ */
+
+#define NX_CLIMSG_PRIO 42
+#define NX_SVRMSG_PRIO 42
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* Client/Connection structures *********************************************/
+
+/* Client state */
+
+enum nx_clistate_e
+{
+ NX_CLISTATE_NOTCONNECTED = 0, /* Waiting for server to acknowledge connection */
+ NX_CLISTATE_CONNECTED, /* Connection established (normal state) */
+ NX_CLISTATE_DISCONNECT_PENDING, /* Waiting for server to acknowledge disconnect */
+};
+
+/* This structure represents a connection between the client and the server */
+
+struct nxfe_conn_s
+{
+ /* This number uniquely identifies the client */
+
+ int cid; /* Client ID (CID) */
+ uint8_t state; /* See enum nx_clistate_e */
+
+ /* These are only usable on the client side of the connection */
+
+ mqd_t crdmq; /* MQ to read from the server (may be non-blocking) */
+ mqd_t cwrmq; /* MQ to write to the server (blocking) */
+
+ /* These are only usable on the server side of the connection */
+
+ mqd_t swrmq; /* MQ to write to the client */
+};
+
+/* Message IDs **************************************************************/
+
+enum nxmsg_e
+{
+ /* Server-to-Client Messages **********************************************/
+
+ NX_CLIMSG_CONNECTED = 1, /* The server has completed the connection and is ready */
+ NX_CLIMSG_DISCONNECTED, /* The server has disconnected */
+ NX_CLIMSG_REDRAW, /* Re-draw the specified window */
+ NX_CLIMSG_NEWPOSITION, /* New window size/position */
+ NX_CLIMSG_MOUSEIN, /* New mouse positional data available for window */
+ NX_CLIMSG_KBDIN, /* New keypad input available for window */
+ NX_CLIMSG_BLOCKED, /* The window is blocked */
+
+ /* Client-to-Server Messages **********************************************/
+
+ NX_SVRMSG_CONNECT, /* Establish connection with new NX server client */
+ NX_SVRMSG_DISCONNECT, /* Tear down connection with terminating client */
+ NX_SVRMSG_OPENWINDOW, /* Create a new window */
+ NX_SVRMSG_CLOSEWINDOW, /* Close an existing window */
+ NX_SVRMSG_BLOCKED, /* The window is blocked */
+ NX_SVRMSG_REQUESTBKGD, /* Open the background window */
+ NX_SVRMSG_RELEASEBKGD, /* Release the background window */
+ NX_SVRMSG_SETPOSITION, /* Window position has changed */
+ NX_SVRMSG_SETSIZE, /* Window size has changed */
+ NX_SVRMSG_GETPOSITION, /* Get the current window position and size */
+ NX_SVRMSG_RAISE, /* Move the window to the top */
+ NX_SVRMSG_LOWER, /* Move the window to the bottom */
+ NX_SVRMSG_SETPIXEL, /* Set a single pixel in the window with a color */
+ NX_SVRMSG_FILL, /* Fill a rectangle in the window with a color */
+ NX_SVRMSG_GETRECTANGLE, /* Get a rectangular region in the window */
+ NX_SVRMSG_FILLTRAP, /* Fill a trapezoidal region in the window with a color */
+ NX_SVRMSG_MOVE, /* Move a rectangular region within the window */
+ NX_SVRMSG_BITMAP, /* Copy a rectangular bitmap into the window */
+ NX_SVRMSG_SETBGCOLOR, /* Set the color of the background */
+ NX_SVRMSG_MOUSEIN, /* New mouse report from mouse client */
+ NX_SVRMSG_KBDIN, /* New keyboard report from keyboard client */
+};
+
+/* Server-to-Client Message Structures **************************************/
+
+/* The generic message structure. All messages begin with this form. */
+
+struct nxclimsg_s
+{
+ uint32_t msgid; /* Any of nxclimsg_e */
+};
+
+/* The server is now connected */
+
+struct nxclimsg_connected_s
+{
+ uint32_t msgid; /* NX_CLIMSG_REDRAW_CONNECTED */
+};
+
+/* The server is now disconnected */
+
+struct nxclimsg_disconnected_s
+{
+ uint32_t msgid; /* NX_CLIMSG_REDRAW_DISCONNECTED */
+};
+
+/* This message is received when a requested window has been opened. If wnd is NULL
+ * then errorcode is the errno value that provides the explanation of the error.
+ */
+
+struct nxclimsg_redraw_s
+{
+ uint32_t msgid; /* NX_CLIMSG_REDRAW */
+ FAR struct nxbe_window_s *wnd; /* The handle to the window to redraw in */
+ FAR struct nxgl_rect_s rect; /* The rectangle to be redrawn */
+ bool more; /* true: more redraw messages follow */
+};
+
+/* This message informs the client of the new size or position of the window */
+
+struct nxclimsg_newposition_s
+{
+ uint32_t msgid; /* NX_CLIMSG_NEWPOSITION */
+ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
+ FAR struct nxgl_size_s size; /* The current window size */
+ FAR struct nxgl_point_s pos; /* The current window position */
+ FAR struct nxgl_rect_s bounds; /* Size of screen */
+};
+
+/* This message reports a new mouse event to a particular window */
+
+#ifdef CONFIG_NX_MOUSE
+struct nxclimsg_mousein_s
+{
+ uint32_t msgid; /* NX_SVRMSG_MOUSEIN */
+ FAR struct nxbe_window_s *wnd; /* The handle of window receiving mouse input */
+ struct nxgl_point_s pos; /* Mouse X/Y position */
+ uint8_t buttons; /* Mouse button set */
+};
+#endif
+
+/* This message reports a new keypad event to a particular window */
+
+#ifdef CONFIG_NX_KBD
+struct nxclimsg_kbdin_s
+{
+ uint32_t msgid; /* NX_CLIMSG_KBDIN */
+ FAR struct nxbe_window_s *wnd; /* The handle of window receiving keypad input */
+ uint8_t nch; /* Number of characters received */
+ uint8_t ch[1]; /* Array of received characters */
+};
+#endif
+
+/* This message confirms that that all queued window messages have been
+ * flushed and that the all further window messages are blocked.
+ */
+
+struct nxclimsg_blocked_s
+{
+ uint32_t msgid; /* NX_CLIMSG_BLOCKED */
+ FAR struct nxbe_window_s *wnd; /* The window that is blocked */
+ FAR void *arg; /* User argument */
+};
+
+/* Client-to-Server Message Structures **************************************/
+
+/* The generic message structure. All server messages begin with this form. Also
+ * messages that have no additional data fields use this structure. This includes:
+ * NX_SVRMSG_CONNECT and NX_SVRMSG_DISCONNECT.
+ */
+
+struct nxsvrmsg_s /* Generic server message */
+{
+ uint32_t msgid; /* One of enum nxsvrmsg_e */
+ FAR struct nxfe_conn_s *conn; /* The specific connection sending the message */
+};
+
+/* This message requests the server to create a new window */
+
+struct nxsvrmsg_openwindow_s
+{
+ uint32_t msgid; /* NX_SVRMSG_OPENWINDOW */
+ FAR struct nxbe_window_s *wnd; /* The pre-allocated window structure */
+};
+
+/* This message informs the server that client wishes to close a window */
+
+struct nxsvrmsg_closewindow_s
+{
+ uint32_t msgid; /* NX_SVRMSG_CLOSEWINDOW */
+ FAR struct nxbe_window_s *wnd; /* The window to be closed */
+};
+
+/* This messsage is just a marker that is queued and forwarded by the server
+ * (NX_CLIMSG_BLOCKED). Messages to the window were blocked just after this
+ * message was sent. Receipt of this message indicates both that the window
+ * blocked and that there are no further queued messages for the window.
+ */
+
+struct nxsvrmsg_blocked_s
+{
+ uint32_t msgid; /* NX_SVRMSG_BLOCKED */
+ FAR struct nxbe_window_s *wnd; /* The window that is blocked */
+ FAR void *arg; /* User argument */
+};
+
+/* This message requests the server to create a new window */
+
+struct nxsvrmsg_requestbkgd_s
+{
+ uint32_t msgid; /* NX_SVRMSG_REQUESTBKGD */
+ FAR struct nxfe_conn_s *conn; /* The specific connection sending the message */
+ FAR const struct nx_callback_s *cb; /* Event handling callbacks */
+ FAR void *arg; /* Client argument used with callbacks */
+};
+
+/* This message informs the server that client wishes to close a window */
+
+struct nxsvrmsg_releasebkgd_s
+{
+ uint32_t msgid; /* NX_SVRMSG_RELEASEBKGD */
+};
+
+/* This message informs the server that the size or position of the window has changed */
+
+struct nxsvrmsg_setposition_s
+{
+ uint32_t msgid; /* NX_SVRMSG_SETPOSITION */
+ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
+ FAR struct nxgl_point_s pos; /* The new window position */
+};
+
+/* This message informs the server that the size or position of the window has changed */
+
+struct nxsvrmsg_setsize_s
+{
+ uint32_t msgid; /* NX_SVRMSG_SETSIZE */
+ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
+ FAR struct nxgl_size_s size; /* The new window size */
+};
+
+/* This message informs the server that the size or position of the window has changed */
+
+struct nxsvrmsg_getposition_s
+{
+ uint32_t msgid; /* NX_SVRMSG_FETPOSITION */
+ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */
+};
+
+/* This message informs the server to raise this window to the top of the display */
+
+struct nxsvrmsg_raise_s
+{
+ uint32_t msgid; /* NX_SVRMSG_RAISE */
+ FAR struct nxbe_window_s *wnd; /* The window to be raised */
+};
+
+/* This message informs the server to lower this window to the bottom of the display */
+
+struct nxsvrmsg_lower_s
+{
+ uint32_t msgid; /* NX_SVRMSG_LOWER */
+ FAR struct nxbe_window_s *wnd; /* The window to be lowered */
+};
+
+/* Set a single pixel in the window with a color */
+
+struct nxsvrmsg_setpixel_s
+{
+ uint32_t msgid; /* NX_SVRMSG_SETPIXEL */
+ FAR struct nxbe_window_s *wnd; /* The window to fill */
+ struct nxgl_point_s pos; /* The position of the pixel in the window */
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
+};
+
+/* Fill a rectangle in the window with a color */
+
+struct nxsvrmsg_fill_s
+{
+ uint32_t msgid; /* NX_SVRMSG_FILL */
+ FAR struct nxbe_window_s *wnd; /* The window to fill */
+ struct nxgl_rect_s rect; /* The rectangle in the window to fill */
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
+};
+
+/* Get a rectangular region from the window */
+
+struct nxsvrmsg_getrectangle_s
+{
+ uint32_t msgid; /* NX_SVRMSG_GETRECTANGLE */
+ FAR struct nxbe_window_s *wnd; /* The window to get from */
+ struct nxgl_rect_s rect; /* The rectangle in the window to get from */
+ unsigned int plane; /* The plane number to read */
+ FAR uint8_t *dest; /* Memory location in which to store the graphics data */
+ unsigned int deststride; /* Width of the destination memory in bytes */
+ sem_t *sem_done; /* Semaphore to report when command is done. */
+};
+
+/* Fill a trapezoidal region in the window with a color */
+
+struct nxsvrmsg_filltrapezoid_s
+{
+ uint32_t msgid; /* NX_SVRMSG_FILLTRAP */
+ FAR struct nxbe_window_s *wnd; /* The window to fill */
+ FAR struct nxgl_rect_s clip; /* The clipping window */
+ struct nxgl_trapezoid_s trap; /* The trapezoidal region in the window to fill */
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
+};
+
+/* Move a rectangular region within the window */
+
+struct nxsvrmsg_move_s
+{
+ uint32_t msgid; /* NX_SVRMSG_MOVE */
+ FAR struct nxbe_window_s *wnd; /* The window within which the move is done */
+ struct nxgl_rect_s rect; /* Describes the rectangular region to move */
+ struct nxgl_point_s offset; /* The offset to move the region */
+};
+
+/* Copy a rectangular bitmap into the window */
+
+struct nxsvrmsg_bitmap_s
+{
+ uint32_t msgid; /* NX_SVRMSG_BITMAP */
+ FAR struct nxbe_window_s *wnd; /* The window with will receive the bitmap image */
+ struct nxgl_rect_s dest; /* Destination location of the bitmap in the window */
+ FAR const void *src[CONFIG_NX_NPLANES]; /* The start of the source image. */
+ struct nxgl_point_s origin; /* Offset into the source image data */
+ unsigned int stride; /* The width of the full source image in pixels. */
+ sem_t *sem_done; /* Semaphore to report when command is done. */
+};
+
+/* Set the color of the background */
+
+struct nxsvrmsg_setbgcolor_s
+{
+ uint32_t msgid; /* NX_SVRMSG_SETBGCOLOR */
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the background */
+};
+
+/* This message reports a new mouse event from a hardware controller attached to
+ * the server as a regular client (this message may have even been sent from an
+ * interrupt handler).
+ */
+
+#ifdef CONFIG_NX_MOUSE
+struct nxsvrmsg_mousein_s
+{
+ uint32_t msgid; /* NX_SVRMSG_MOUSEIN */
+ struct nxgl_point_s pt; /* Mouse X/Y position */
+ uint8_t buttons; /* Mouse button set */
+};
+#endif
+
+/* This message reports a new keyboard event from a hardware controller attached to
+ * some kind of keypad (this message may have even been sent from an
+ * interrupt handler).
+ */
+
+#ifdef CONFIG_NX_KBD
+struct nxsvrmsg_kbdin_s
+{
+ uint32_t msgid; /* NX_SVRMSG_KBDIN */
+ uint8_t nch ; /* Number of characters received */
+ uint8_t ch[1]; /* Array of received characters */
+};
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxfe_constructwindow
+ *
+ * Description:
+ * This function is the same a nx_openwindow EXCEPT that the client provides
+ * the window structure instance. nx_constructwindow will initialize the
+ * the pre-allocated window structure for use by NX. This function is
+ * provided in addition to nx_open window in order to support a kind of
+ * inheritance: The caller's window structure may include extensions that
+ * are not visible to NX.
+ *
+ * NOTE: wnd must have been allocated using kmalloc() (or related allocators)
+ * Once provided to nxfe_constructwindow() that memory is owned and managed
+ * by NX. On certain error conditions or when the window is closed, NX will
+ * free the window.
+ *
+ * Input Parameters:
+ * handle - The handle returned by nx_connect
+ * wnd - The pre-allocated window structure.
+ * cb - Callbacks used to process window events
+ * arg - User provided value that will be returned with NX callbacks.
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately. In the
+ * case of ERROR, NX will have deallocated the pre-allocated window.
+ *
+ ****************************************************************************/
+
+int nxfe_constructwindow(NXHANDLE handle,
+ FAR struct nxbe_window_s *wnd,
+ FAR const struct nx_callback_s *cb,
+ FAR void *arg);
+
+/****************************************************************************
+ * Name: nxmu_semtake
+ *
+ * Description:
+ * Take the semaphore, handling EINTR wakeups. See the nxmu_semgive macro.
+ *
+ * Input Parameters:
+ * sem - the semaphore to be taken.
+ *
+ * Return:
+ * None
+ *
+ ****************************************************************************/
+
+void nxmu_semtake(sem_t *sem);
+
+/****************************************************************************
+ * Name: nxmu_sendserver
+ *
+ * Description:
+ * Send a message to the server at NX_SVRMSG_PRIO priority
+ *
+ * Input Parameters:
+ * conn - A pointer to the server connection 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_sendserver(FAR struct nxfe_conn_s *conn,
+ FAR const void *msg, size_t msglen);
+
+/****************************************************************************
+ * 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);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __INCLUDE_NUTTX_NX_NXMU_H */
diff --git a/nuttx/libc/Makefile b/nuttx/libc/Makefile
index 94884bd80..759fcec18 100644
--- a/nuttx/libc/Makefile
+++ b/nuttx/libc/Makefile
@@ -65,6 +65,7 @@ include mqueue/Make.defs
include math/Make.defs
include fixedmath/Make.defs
include net/Make.defs
+include nx/Make.defs
include time/Make.defs
include libgen/Make.defs
include dirent/Make.defs
diff --git a/nuttx/libc/audio/Make.defs b/nuttx/libc/audio/Make.defs
index a611e3270..bffc74e15 100644
--- a/nuttx/libc/audio/Make.defs
+++ b/nuttx/libc/audio/Make.defs
@@ -36,7 +36,7 @@
ifeq ($(CONFIG_AUDIO),y)
CSRCS += lib_buffer.c
-# Add the misc directory to the build
+# Add the audio/ directory to the build
DEPPATH += --dep-path audio
VPATH += :audio
diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h
index c2be50a32..ee4d751e9 100644
--- a/nuttx/libc/lib_internal.h
+++ b/nuttx/libc/lib_internal.h
@@ -91,7 +91,7 @@
# define lib_memalign(p,s) krealloc(p,s)
# define lib_free(p) kfree(p)
- /* User-accesssible allocations */
+ /* User-accessible allocations */
# define lib_umalloc(s) kumalloc(s)
# define lib_uzalloc(s) kuzalloc(s)
@@ -108,7 +108,7 @@
# define lib_realloc(p,s) realloc(p,s)
# define lib_free(p) free(p)
- /* User-accesssible allocations */
+ /* User-accessible allocations */
# define lib_umalloc(s) malloc(s)
# define lib_uzalloc(s) zalloc(s)
diff --git a/nuttx/libc/misc/lib_match.c b/nuttx/libc/misc/lib_match.c
index 4f96542f6..3bebb1a94 100644
--- a/nuttx/libc/misc/lib_match.c
+++ b/nuttx/libc/misc/lib_match.c
@@ -60,7 +60,6 @@ static int match_one(const char *pattern, int patlen, const char *string)
{
const char *p;
char first;
- char last;
int pl;
int i;
@@ -101,7 +100,6 @@ static int match_one(const char *pattern, int patlen, const char *string)
if (*p == '-')
{
p++;
- last = *p++;
if (*string >= first && *string <= *p)
{
/* Match found. Advance to the ']' */
diff --git a/nuttx/libc/nx/Make.defs b/nuttx/libc/nx/Make.defs
new file mode 100644
index 000000000..57f97f65a
--- /dev/null
+++ b/nuttx/libc/nx/Make.defs
@@ -0,0 +1,55 @@
+############################################################################
+# libc/nx/Make.defs
+#
+# Copyright (C) 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.
+#
+############################################################################
+
+# Check if the NX graphics subsystem is enabled
+
+ifeq ($(CONFIG_NX),y)
+
+# All of user-space hooks must be built in for the multi-user NX
+# implementation so that they are available to the application in the kernel
+# 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_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
+endif
+
+# Add the nx/ directory to the build
+
+DEPPATH += --dep-path nx
+VPATH += :nx
+endif
diff --git a/nuttx/graphics/nxmu/nx_block.c b/nuttx/libc/nx/lib_nx_block.c
index 7b198613c..7468ac6eb 100644
--- a/nuttx/graphics/nxmu/nx_block.c
+++ b/nuttx/libc/nx/lib_nx_block.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_block.c
+ * libc/lib/lib_nx_block.c
*
- * 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
@@ -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
@@ -145,4 +144,3 @@ int nx_block(NXWINDOW hwnd, FAR void *arg)
return ret;
}
-
diff --git a/nuttx/graphics/nxmu/nx_closewindow.c b/nuttx/libc/nx/lib_nx_closewindow.c
index f9722fcd2..f38d20922 100644
--- a/nuttx/graphics/nxmu/nx_closewindow.c
+++ b/nuttx/libc/nx/lib_nx_closewindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_closewindow.c
+ * libc/lib/lib_nx_closewindow.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
@@ -44,7 +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
@@ -70,7 +71,6 @@
* Public Functions
****************************************************************************/
-
/****************************************************************************
* Name: nx_closewindow
*
@@ -97,4 +97,3 @@ int nx_closewindow(NXWINDOW hwnd)
return nxmu_sendserver(wnd->conn, &outmsg, sizeof(struct nxsvrmsg_closewindow_s));
}
-
diff --git a/nuttx/graphics/nxmu/nx_connect.c b/nuttx/libc/nx/lib_nx_connect.c
index 2c14579ee..39ed851f6 100644
--- a/nuttx/graphics/nxmu/nx_connect.c
+++ b/nuttx/libc/nx/lib_nx_connect.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * graphics/nxmu/nx_connect.c
+ * libc/lib/lib_nx_connect.c
*
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -47,10 +47,10 @@
#include <errno.h>
#include <debug.h>
-#include <nuttx/kmalloc.h>
#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxmu.h>
-#include "nxfe.h"
+#include "lib_internal.h"
/****************************************************************************
* Pre-Processor Definitions
@@ -125,17 +125,17 @@ NXHANDLE nx_connectinstance(FAR const char *svrmqname)
#ifdef CONFIG_DEBUG
if (!svrmqname)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return NULL;
}
#endif
/* Allocate the NX client structure */
- conn = (FAR struct nxfe_conn_s *)kzalloc(sizeof(struct nxfe_conn_s));
+ conn = (FAR struct nxfe_conn_s *)lib_zalloc(sizeof(struct nxfe_conn_s));
if (!conn)
{
- errno = ENOMEM;
+ set_errno(ENOMEM);
goto errout;
}
@@ -215,8 +215,7 @@ errout_with_wmq:
errout_with_rmq:
mq_close(conn->crdmq);
errout_with_conn:
- kfree(conn);
+ lib_free(conn);
errout:
return NULL;
}
-
diff --git a/nuttx/graphics/nxmu/nx_disconnect.c b/nuttx/libc/nx/lib_nx_disconnect.c
index 48e1e9cc0..87d2f3b0c 100644
--- a/nuttx/graphics/nxmu/nx_disconnect.c
+++ b/nuttx/libc/nx/lib_nx_disconnect.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_disconnect.c
+ * libc/lib/lib_nx_disconnect.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
@@ -44,7 +44,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -105,4 +105,3 @@ void nx_disconnect(NXHANDLE handle)
gdbg("ERROR: nxmu_sendserver() returned %d\n", ret);
}
}
-
diff --git a/nuttx/graphics/nxmu/nx_kbdchin.c b/nuttx/libc/nx/lib_nx_kbdchin.c
index 6c7019f51..20d99c4b6 100644
--- a/nuttx/graphics/nxmu/nx_kbdchin.c
+++ b/nuttx/libc/nx/lib_nx_kbdchin.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_kbdchin.c
+ * libc/lib/lib_nx_kbdchin.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
@@ -44,7 +44,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
#ifdef CONFIG_NX_KBD
diff --git a/nuttx/graphics/nxmu/nx_kbdin.c b/nuttx/libc/nx/lib_nx_kbdin.c
index 69d96ea91..f8d266d98 100644
--- a/nuttx/graphics/nxmu/nx_kbdin.c
+++ b/nuttx/libc/nx/lib_nx_kbdin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * graphics/nxmu/nx_kbdin.c
+ * libc/lib/lib_nx_kbdin.c
*
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -40,14 +40,12 @@
#include <nuttx/config.h>
#include <stdint.h>
-#include <stdlib.h>
#include <errno.h>
-#include <debug.h>
-#include <nuttx/kmalloc.h>
#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxmu.h>
-#include "nxfe.h"
+#include "lib_internal.h"
#ifdef CONFIG_NX_KBD
@@ -98,10 +96,10 @@ int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch)
*/
size = sizeof(struct nxsvrmsg_kbdin_s) + nch - 1;
- outmsg = (FAR struct nxsvrmsg_kbdin_s *)kmalloc(size);
+ outmsg = (FAR struct nxsvrmsg_kbdin_s *)lib_malloc(size);
if (!outmsg)
{
- errno = ENOMEM;
+ set_errno(ENOMEM);
return ERROR;
}
@@ -117,7 +115,7 @@ int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch)
ret = nxmu_sendserver(conn, outmsg, size);
- kfree(outmsg);
+ lib_free(outmsg);
return ret;
}
diff --git a/nuttx/graphics/nxmu/nx_mousein.c b/nuttx/libc/nx/lib_nx_mousein.c
index e84278539..bff937daa 100644
--- a/nuttx/graphics/nxmu/nx_mousein.c
+++ b/nuttx/libc/nx/lib_nx_mousein.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_mousein.c
+ * libc/lib/lib_nx_mousein.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
@@ -44,7 +44,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
#ifdef CONFIG_NX_MOUSE
diff --git a/nuttx/graphics/nxmu/nx_releasebkgd.c b/nuttx/libc/nx/lib_nx_releasebkgd.c
index 972585663..2d2987eae 100644
--- a/nuttx/graphics/nxmu/nx_releasebkgd.c
+++ b/nuttx/libc/nx/lib_nx_releasebkgd.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_releasebkgd.c
+ * libc/lib/lib_nx_releasebkgd.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_releasebkgd(NXWINDOW hwnd)
#ifdef CONFIG_DEBUG
if (!wnd)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
@@ -102,4 +103,3 @@ int nx_releasebkgd(NXWINDOW hwnd)
outmsg.msgid = NX_SVRMSG_RELEASEBKGD;
return nxmu_sendserver(wnd->conn, &outmsg, sizeof(struct nxsvrmsg_releasebkgd_s));
}
-
diff --git a/nuttx/graphics/nxmu/nx_requestbkgd.c b/nuttx/libc/nx/lib_nx_requestbkgd.c
index c8f71ab2a..d61f3f9ad 100644
--- a/nuttx/graphics/nxmu/nx_requestbkgd.c
+++ b/nuttx/libc/nx/lib_nx_requestbkgd.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_requestbkgd.c
+ * libc/lib/lib_nx_requestbkgd.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,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -119,7 +119,7 @@ int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb,
#ifdef CONFIG_DEBUG
if (!conn || !cb)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
@@ -133,4 +133,3 @@ int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb,
return nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_requestbkgd_s));
}
-
diff --git a/nuttx/graphics/nxmu/nx_setbgcolor.c b/nuttx/libc/nx/lib_nx_setbgcolor.c
index 63fca5f55..d8f0803d6 100644
--- a/nuttx/graphics/nxmu/nx_setbgcolor.c
+++ b/nuttx/libc/nx/lib_nx_setbgcolor.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_setbgcolor.c
+ * libc/lib/lib_nx_setbgcolor.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,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -93,7 +93,7 @@ int nx_setbgcolor(NXHANDLE handle,
#ifdef CONFIG_DEBUG
if (!conn)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/graphics/nxmu/nxmu_constructwindow.c b/nuttx/libc/nx/lib_nxmu_constructwindow.c
index 5392c28b7..70d951b4e 100644
--- a/nuttx/graphics/nxmu/nxmu_constructwindow.c
+++ b/nuttx/libc/nx/lib_nxmu_constructwindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nx_openwindow.c
+ * libc/lib/lib_nx_openwindow.c
*
- * Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008, 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,10 +43,11 @@
#include <errno.h>
#include <debug.h>
-#include <nuttx/kmalloc.h>
#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxbe.h>
+#include <nuttx/nx/nxmu.h>
-#include "nxfe.h"
+#include "lib_internal.h"
/****************************************************************************
* Pre-Processor Definitions
@@ -96,7 +97,7 @@
*
* Return:
* OK on success; ERROR on failure with errno set appropriately. In the
- * case of ERROR, NX will have dealloated the pre-allocated window.
+ * case of ERROR, NX will have deallocated the pre-allocated window.
*
****************************************************************************/
@@ -109,14 +110,14 @@ int nxfe_constructwindow(NXHANDLE handle, FAR struct nxbe_window_s *wnd,
#ifdef CONFIG_DEBUG
if (!wnd)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
if (!conn || !cb)
{
- kfree(wnd);
- errno = EINVAL;
+ lib_free(wnd);
+ set_errno(EINVAL);
return ERROR;
}
#endif
@@ -136,4 +137,3 @@ int nxfe_constructwindow(NXHANDLE handle, FAR struct nxbe_window_s *wnd,
return nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_openwindow_s));
}
-
diff --git a/nuttx/graphics/nxmu/nxmu_sendserver.c b/nuttx/libc/nx/lib_nxmu_sendserver.c
index 03ece4e7f..1bdae3b02 100644
--- a/nuttx/graphics/nxmu/nxmu_sendserver.c
+++ b/nuttx/libc/nx/lib_nxmu_sendserver.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * graphics/nxmu/nxmu_sendserver.c
+ * libc/nx/lib_nxmu_sendserver.c
*
- * 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
@@ -43,7 +43,7 @@
#include <errno.h>
#include <debug.h>
-#include "nxfe.h"
+#include <nuttx/nx/nxmu.h>
/****************************************************************************
* Pre-Processor Definitions