9
0
Fork 0

Add beginnings of an NX console driver

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4524 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-03-26 22:10:21 +00:00
parent ea6f225210
commit 5f606f01b3
13 changed files with 1215 additions and 36 deletions

View File

@ -2596,5 +2596,5 @@
Assis, and Stefan Richter.
* arch/arm/src/lpc17xx: Several fixes for error that have crept in for the LPC17xx
DAC. Contriburted by by Lzzy.
* graphics/nxconsole: Add a character driver that can be used as a console output
device for text output (still under development on initial check-in).

View File

@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec">
<i>NX Graphics Subsystem</i>
</font></big></h1>
<p>Last Updated: December 1, 2011</p>
<p>Last Updated: March 25, 2012</p>
</td>
</tr>
</table>
@ -44,7 +44,7 @@
<i>1.3.2 <a href="#nx1">NX (NXSU and NXMU)</a></i><br>
<i>1.3.3 <a href="#nxtk1">NX Tool Kit (<code>NXTK</code>)</a></i><br>
<i>1.3.4 <a href="#nxfonts1">NX Fonts Support (<code>NXFONTS</code>)</a></i><br>
<i>1.3.5 <a href="#nxwidgets1">NX Widgets (<code>NXWIDGETS</code>)</a></i>
<i>1.3.5 <a href="#nxwidgets1">NX Widgets (<code>NxWidgets</code>)</a></i>
</ul>
</p>
</ul>
@ -349,7 +349,7 @@
larger multi-user implentation (NXMU as described below).
Both conform to the same APIs as defined in <code>include/nuttx/nx/nx.h</code> and, hence,
are interchangable<sup>1</sup>.
NX can be used without NXWIDGETS and without NXTOOLKIT for raw window displays.
NX can be used without NxWidgets and without NXTOOLKIT for raw window displays.
</p>
<p>
@ -381,7 +381,7 @@
NXTK is a s set of C graphics tools that provide higher-level window drawing
operations.
This is the module where the framed windows and toolbar logic is implemented.
NXTK is built on top of NX and does not depend on NXWIDGETS.
NXTK is built on top of NX and does not depend on NxWidgets.
</p>
<h3>1.3.4 <a name="nxfonts1">NX Fonts Support (<code>NXFONTS</code>)</a></h3>
@ -393,19 +393,12 @@
NXFONTS does not depend on any NX module other than some utilities and types from NXGLIB.
</p>
<h3>1.3.5 <a name="nxwidgets1">NX Widgets (<code>NXWIDGETS</code>)</a></h3>
<h3>1.3.5 <a name="nxwidgets1">NX Widgets (<code>NxWidgets</code>)</a></h3>
<p>
I had originally planned a high level, C++, object-oriented library for
object-oriented access to graphics <i>widgets</i>.
However, C++ compilers are not available for some of the targets supported by NuttX.
So I have decided to implement the entire solution in C.
That decision makes the solution somewhat more difficult to work with, but supports all platforms.
</p>
<p>
At this point, the amount of C in the implementation would make conversion to C++ a
more difficult job.
I leave the C++ widget interface to any contributor who may have an interest in such things.
<a href="NxWidgets.html">NxWidgets</a> is a higher level, C++, object-oriented library for object-oriented access to graphical &quot;widgets.&quot;
NxWidgets is provided as a separate package.
NxWidgets is built on top of the core NuttX graphics subsystem, but is not a part of the core graphics subystems.
</p>
<table width ="100%">
@ -427,8 +420,6 @@
<dd>Describe the NXTOOLKIT C interfaces
<dt><code>include/nutt/nxfont.h</code>
<dd>Describe sthe NXFONT C interfaces
<dt><code>include/nuttx/nx/nxwidgets.h</code>
<dd>Will describe the NXWIDGETS classes (no longer planned)
</dl></ul>
<h2>2.2 <a name="nxgl2">NX Graphics Library (<code>NXGL</code>)</a></h2>
@ -3190,8 +3181,9 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
multi-user NX version.
See <code>include/nuttx/nx/nxtk.h</code>.
<dt><code>graphics/nxwidgets</code>
<dd>At one time, I planned to put NXWIDGETS implementation here, but not anymore.
<dt><code>nuttx/../nxwidgets</code>
<dd>The <a href="NxWidgets.html">NxWidgets</a> code is provided as a separate package located outside of the
NuttX source tree (probably at this location).
</dl>
</ul>

View File

@ -53,7 +53,6 @@
<li><a href="http://www.2g-eng.com" target="top">2G Engineering</a></li>
<li><a href="http://isotel.eu/Home/" target="top">ISOTEL Research</a></li>
<li><a href="http://www.dspworks.in/" target="top">DSPWorks</a></li>
<li><a href="http://www.nx-engineering.com/products/" target="top">NXWidgets</a></li>
</tr>
<tr>
<td colspan="2" align="center" valign="top">

View File

@ -68,10 +68,14 @@ include nxfonts/Make.defs
DEPPATH += --dep-path nxfonts
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxfonts}
ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXFONTS_ASRCS)
include nxconsole/Make.defs
DEPPATH += --dep-path nxconsole
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxconsole}
ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXFONTS_ASRCS) $(NXCON_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = $(NXGLIB_CSRCS) $(NXBE_CSRCS) $(NX_CSRCS) $(NXTK_CSRCS) $(NXFONTS_CSRCS)
CSRCS = $(NXGLIB_CSRCS) $(NXBE_CSRCS) $(NX_CSRCS) $(NXTK_CSRCS) $(NXFONTS_CSRCS) $(NXCON_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
@ -80,9 +84,9 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libgraphics$(LIBEXT)
ifeq ($(CONFIG_NX_MULTIUSER),y)
VPATH = nxglib:nxbe:nxmu:nxtk:nxfonts
VPATH = nxglib:nxbe:nxmu:nxtk:nxfonts:nxconsole
else
VPATH = nxglib:nxbe:nxsu:nxtk:nxfonts
VPATH = nxglib:nxbe:nxsu:nxtk:nxfonts:nxconsole
endif
all: mklibgraphics

View File

@ -18,20 +18,19 @@ Roadmap
This directory holds NuttX graphic packages. Not all of these packages are implemented
at the present, but here is the longer term roadmap:
NXWIDGETS - I had originally planned a high level, C++, object-oriented library for
object-oriented access to graphics widgets. However, because C++ compilers
are not available for some of the targets supported by NuttX, I have
decided to implement the entire solution in C -- that makes the solution
much uglier, but works fine on all platforms.
NxWidgets - NxWidgets is a higher level, C++, object-oriented library for object-
oriented access to graphics "widgets." NxWidgets is provided as a separate
package. NxWidgets is built on top of the core NuttX graphics subsystem,
but is not a part of the core graphics subystems.
NXTOOLKIT - A set of C graphics tools that provide higher-level window drawing
operations. The toolkit can be used for window-oriented graphics
without NXWIDGETS and is built on top of NX.
without NxWidgets and is built on top of NX.
NXFONTS - A set of C graphics tools for present (bitmap) font images.
NX - The tiny NuttX windowing system. This includes both a small-footprint,
single user implementaton (NXSU as described below) and a somewhat
larger multi-user implentation (NXMU as described below). Both
conform to the same APIs as defined in include/nuttx/nx/nx.h and, hence,
are more-or-less interchangable. NX can be used without NXWIDGETS
are more-or-less interchangable. NX can be used without NxWidgets
and without NXTOOLKIT for raw access to window memory.
NXGLIB - Low level graphics utilities and direct framebuffer rendering logic.
NX is built on top of NXGLIB.
@ -43,7 +42,6 @@ include/nuttx/nx/nxglib.h -- Describes the NXGLIB C interfaces
include/nuttx/nx/nx.h -- Describes the NX C interfaces
include/nuttx/nx/nxtk.h -- Describe the NXTOOLKIT C interfaces
include/nuttx/nx/nxfont.h -- Describe sthe NXFONT C interfaces
include/nuttx/nx/nxwidgets.h -- Will describe the NXWIDGETS classes (no longer planned)
Directories
^^^^^^^^^^^
@ -85,8 +83,9 @@ graphics/nxtk
top of NX and works with either the single-user or multi-user NX version. See
include/nuttx/nx/nxtk.h
graphics/nxwidgets
At one time, I planned to put NXWIDGETS implementation here, but not anymore.
nuttx/../NxWidgets
The NxWidgets code is provided as a separate package located outside of the
NuttX source tree (probably at this location).
Installing New Fonts
^^^^^^^^^^^^^^^^^^^^

View File

@ -0,0 +1,38 @@
############################################################################
# graphics/nxconsole/Make.defs
#
# 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.
#
############################################################################
NXCON_ASRCS =
NXCON_CSRCS = nx_register.c nxcon_register.c nxcon_unregister.c
NXCON_CSRCS += nxtk_register.c nxtool_register.c

View File

@ -0,0 +1,193 @@
/****************************************************************************
* nuttx/graphics/nxconsole/nx_register.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 <nuttx/nx/nx.h>
#include <nuttx/nx/nxconsole.h>
#include "nxcon_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int nxcon_fill(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
#ifndef CONFIG_NXCONSOLE_NOGETRUN
static int nxcon_move(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
#endif
static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct nxcon_operations_s g_nxops =
{
nxcon_fill,
#ifndef CONFIG_NXCONSOLE_NOGETRUN
nxcon_move,
#endif
nxcon_bitmap
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: nxcon_fill
*
* Description:
* Fill the specified rectangle in the window with the specified color
*
* Input Parameters:
* priv - The driver state structure.
* rect - The location to be filled
* color - The color to use in the fill
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
static int nxcon_fill(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
{
return nx_fill((NXWINDOW)priv->handle, rect, wcolor);
}
/****************************************************************************
* Name: nxcon_move
*
* Description:
* Move a rectangular region within the window
*
* Input Parameters:
* priv - The driver state structure.
* rect - Describes the rectangular region to move
* offset - The offset to move the region. The rectangular region will be
* moved so that the origin is translated by this amount.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#ifndef CONFIG_NXCONSOLE_NOGETRUN
static int nxcon_move(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset)
{
return nx_move((NXWINDOW)priv->handle, rect, offset);
}
#endif
/****************************************************************************
* Name: nxcon_bitmap
*
* Description:
* Copy a rectangular region of a larger image into the rectangle in the
* specified window.
*
* Input Parameters:
* priv - The driver state structure.
* dest - Describes the rectangular region on the display that will
* receive the bit map.
* src - The start of the source image. This is an array source
* images of size CONFIG_NX_NPLANES.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
* stride - The width of the full source image in bytes.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride)
{
return nx_bitmap((NXWINDOW)priv->handle, dest, src, origin, stride);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nx_register
*
* Description:
* Register a console device on a raw NX window. The device will be
* registered at /dev/nxconN where N is the provided minor number.
*
* Input Parameters:
* hwnd - A handle that will be used to access the window. The window must
* persist and this handle must be valid for the life of the NX console.
* wndo - Describes the window and font to be used
* minor - The device minor number
*
* Return:
* A non-NULL handle is returned on success.
*
****************************************************************************/
NXCONSOLE nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo, int minor)
{
return nxcon_register((NXCONSOLE)hwnd, wndo, &g_nxops, minor);
}

View File

@ -0,0 +1,170 @@
/****************************************************************************
* nuttx/graphics/nxconsole/nxcon_internal.h
*
* 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.
*
****************************************************************************/
#ifndef __GRAPHICS_NXCONSOLE_NXCON_INTERNAL_H
#define __GRAPHICS_NXCONSOLE_NXCON_INTERNAL_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <nuttx/fs/fs.h>
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxtk.h>
#include <nuttx/nx/nxfonts.h>
#include <nuttx/nx/nxconsole.h>
/****************************************************************************
* Definitions
****************************************************************************/
/* Bitmap flags */
#define BMFLAGS_NOGLYPH (1 << 0) /* No glyph available, use space */
#define BM_ISSPACE(bm) (((bm)->flags & BMFLAGS_NOGLYPH) != 0)
/* Sizes and maximums */
#define MAX_USECNT 255 /* Limit to range of a uint8_t */
#define LINE_SEPARATION 2 /* Space (in rows) between lines */
/* Device path formats */
#define NX_DEVNAME_FORMAT "/dev/nxcon%d"
#define NX_DEVNAME_SIZE 16
/****************************************************************************
* Public Types
****************************************************************************/
/* Describes on set of console window callbacks */
struct nxcon_state_s;
struct nxcon_operations_s
{
int (*fill)(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
#ifndef CONFIG_NXCONSOLE_NOGETRUN
int (*move)(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
#endif
int (*bitmap)(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
};
/* Describes one cached glyph bitmap */
struct nxcon_glyph_s
{
uint8_t code; /* Character code */
uint8_t height; /* Height of this glyph (in rows) */
uint8_t width; /* Width of this glyph (in pixels) */
uint8_t stride; /* Width of the glyph row (in bytes) */
uint8_t usecnt; /* Use count */
FAR uint8_t *bitmap; /* Allocated bitmap memory */
};
/* Describes on character on the display */
struct nxcon_bitmap_s
{
uint8_t code; /* Character code */
uint8_t flags; /* See BMFLAGS_* */
struct nxgl_point_s pos; /* Character position */
};
/* Describes the state of one NX console driver*/
struct nxcon_state_s
{
FAR const struct nxcon_operations_s *ops; /* Window operations */
FAR void *handle; /* The window handle */
uint8_t minor; /* Device minor number */
FAR struct nxcon_window_s wndo; /* Describes the window and font */
/* These characterize the font in use */
NXHANDLE font; /* The current font handle */
uint8_t fheight; /* Max height of a font in pixels */
uint8_t fwidth; /* Max width of a font in pixels */
uint8_t spwidth; /* The width of a space */
struct nxgl_point_s fpos; /* Next display position */
/* These describe all text already added to the display */
uint8_t maxglyphs; /* Size of the glyph[] array */
uint16_t maxchars; /* Size of the bm[] array */
uint16_t nchars; /* Number of chars in the bm[] array */
FAR struct nxcon_bitmap_s *bm; /* List of characters on the display */
FAR struct nxcon_glyph_s *glyph; /* Cache of rendered fonts in use */
};
/****************************************************************************
* Public Variables
****************************************************************************/
/* This is the common NX driver file operations */
extern const struct file_operations g_nxcondrvrops;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/* Common device registration */
FAR struct nxcon_state_s *nxcon_register(NXCONSOLE handle,
FAR struct nxcon_window_s *wndo, FAR const struct nxcon_operations_s *ops,
int minor);
/* Generic text helpers */
void nxcon_home(FAR struct nxcon_state_s *priv);
void nxcon_newline(FAR struct nxcon_state_s *priv);
void nxcon_putc(FAR struct nxcon_state_s *priv, NXHANDLE hfont, uint8_t ch);
void nxcon_fillchar(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect, FAR const struct nxcon_bitmap_s *bm);
#endif /* __GRAPHICS_NXCONSOLE_NXCON_INTERNAL_H */

View File

@ -0,0 +1,123 @@
/****************************************************************************
* nuttx/graphics/nxconsole/nxcon_register.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 <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include "nxcon_internal.h"
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxcon_allocate
****************************************************************************/
FAR struct nxcon_state_s *
nxcon_register(NXCONSOLE handle, FAR struct nxcon_window_s *wndo,
FAR const struct nxcon_operations_s *ops, int minor)
{
FAR struct nxcon_state_s *priv;
char devname[NX_DEVNAME_SIZE];
int ret;
DEBUGASSERT(handle && wndo && ops && (unsigned)minor < 256);
/* Allocate the driver structure */
priv = (FAR struct nxcon_state_s *)kzalloc(sizeof(struct nxcon_state_s));
if (!priv)
{
gdbg("Failed to allocate the NX driver structure\n");
return NULL;
}
/* Initialize the driver structure */
priv->ops = ops;
priv->handle = handle;
priv->minor = minor;
memcpy(&priv->wndo, wndo, sizeof( struct nxcon_window_s));
/* Select the font */
priv->font = nxf_getfonthandle(wndo->fontid);
if (!priv->font)
{
gdbg("Failed to get font ID %d: %d\n", wndo->fontid, errno);
goto errout;
}
/* Register the driver */
snprintf(devname, NX_DEVNAME_SIZE, NX_DEVNAME_FORMAT, minor);
ret = register_driver(devname, &g_nxcondrvrops, 0666, priv);
if (ret < 0)
{
gdbg("Failed to register %s\n", devname);
}
return (NXCONSOLE)priv;
errout:
kfree(priv);
return NULL;
}

View File

@ -0,0 +1,101 @@
/****************************************************************************
* nuttx/graphics/nxconsole/nxcon_unregister.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 <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/nx/nxconsole.h>
#include "nxcon_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxcon_unregister
*
* Description:
* Un-register to NX console device.
*
* Input Parameters:
* handle - A handle previously returned by nx_register, nxtk_register, or
* nxtool_register.
*
* Returned Value:
* None
*
****************************************************************************/
void nxcon_unregister(NXCONSOLE handle)
{
FAR struct nxcon_state_s *priv;
char devname[NX_DEVNAME_SIZE];
/* Unregister the driver */
snprintf(devname, NX_DEVNAME_SIZE, NX_DEVNAME_FORMAT, priv->minor);
(void)unregister_driver(devname);
/* Free the private data structure */
kfree(handle);
}

View File

@ -0,0 +1,192 @@
/****************************************************************************
* nuttx/graphics/nxconsole/nxtk_register.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 <nuttx/nx/nxtk.h>
#include <nuttx/nx/nxconsole.h>
#include "nxcon_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int nxtkcon_fill(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
#ifndef CONFIG_NXCONSOLE_NOGETRUN
static int nxtkcon_move(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
#endif
static int nxtkcon_bitmap(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct nxcon_operations_s g_nxtkops =
{
nxtkcon_fill,
#ifndef CONFIG_NXCONSOLE_NOGETRUN
nxtkcon_move,
#endif
nxtkcon_bitmap
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: nxtkcon_fill
*
* Description:
* Fill the specified rectangle in the window with the specified color
*
* Input Parameters:
* priv - The driver state structure.
* rect - The location to be filled
* color - The color to use in the fill
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
static int nxtkcon_fill(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
{
return nxtk_fillwindow((NXTKWINDOW)priv->handle, rect, wcolor);
}
/****************************************************************************
* Name: nxtkcon_move
*
* Description:
* Move a rectangular region within the window
*
* Input Parameters:
* priv - The driver state structure.
* rect - Describes the rectangular region to move
* offset - The offset to move the region. The rectangular region will be
* moved so that the origin is translated by this amount.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#ifndef CONFIG_NXCONSOLE_NOGETRUN
static int nxtkcon_move(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset)
{
return nxtk_movewindow((NXTKWINDOW)priv->handle, rect, offset);
}
#endif
/****************************************************************************
* Name: nxtkcon_bitmap
*
* Description:
* Copy a rectangular region of a larger image into the rectangle in the
* specified window.
*
* Input Parameters:
* priv - The driver state structure.
* dest - Describes the rectangular region on the display that will
* receive the bit map.
* src - The start of the source image. This is an array source
* images of size CONFIG_NX_NPLANES.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
* stride - The width of the full source image in bytes.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
static int nxtkcon_bitmap(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride)
{
return nxtk_bitmapwindow((NXTKWINDOW)priv->handle, dest, src, origin, stride);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxtk_register
*
* Description:
* Register a console device on a framed NX window. The device will be
* registered at /dev/nxtkN where N is the provided minor number.
*
* Input Parameters:
* hfwnd - A handle that will be used to access the window. The window must
* persist and this handle must be valid for the life of the NX console.
* wndo - Describes the window and font to be used
* minor - The device minor number
*
* Return:
* A non-NULL handle is returned on success.
*
****************************************************************************/
NXCONSOLE nxtk_register(NXTKWINDOW hfwnd, FAR struct nxcon_window_s *wndo, int minor)
{
return nxcon_register((NXCONSOLE)hfwnd, wndo, &g_nxtkops, minor);
}

View File

@ -0,0 +1,195 @@
/****************************************************************************
* nuttx/graphics/nxconsole/nxtool_register.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 <nuttx/nx/nxtk.h>
#include <nuttx/nx/nxconsole.h>
#include "nxcon_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int nxtool_fill(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
#ifndef CONFIG_NXCONSOLE_NOGETRUN
static int nxtool_move(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
#endif
static int nxtool_bitmap(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct nxcon_operations_s g_nxtoolops =
{
nxtool_fill,
#ifndef CONFIG_NXCONSOLE_NOGETRUN
nxtool_move,
#endif
nxtool_bitmap
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: nxtool_fill
*
* Description:
* Fill the specified rectangle in the window with the specified color
*
* Input Parameters:
* priv - The driver state structure.
* rect - The location to be filled
* color - The color to use in the fill
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
static int nxtool_fill(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
{
return nxtk_filltoolbar((NXTKWINDOW)priv->handle, rect, wcolor);
}
/****************************************************************************
* Name: nxtool_move
*
* Description:
* Move a rectangular region within the window
*
* Input Parameters:
* priv - The driver state structure.
* rect - Describes the rectangular region to move
* offset - The offset to move the region. The rectangular region will be
* moved so that the origin is translated by this amount.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#ifndef CONFIG_NXCONSOLE_NOGETRUN
static int nxtool_move(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset)
{
return nxtk_movetoolbar((NXTKWINDOW)priv->handle, rect, offset);
}
#endif
/****************************************************************************
* Name: nxtool_bitmap
*
* Description:
* Copy a rectangular region of a larger image into the rectangle in the
* specified window.
*
* Input Parameters:
* priv - The driver state structure.
* dest - Describes the rectangular region on the display that will
* receive the bit map.
* src - The start of the source image. This is an array source
* images of size CONFIG_NX_NPLANES.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
* stride - The width of the full source image in bytes.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
static int nxtool_bitmap(FAR struct nxcon_state_s *priv,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride)
{
return nxtk_bitmaptoolbar((NXTKWINDOW)priv->handle, dest, src, origin, stride);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxtool_register
*
* Description:
* Register a console device on a toolbar of a framed NX window. The
* device will be registered at /dev/nxtoolN where N is the provided minor
* number.
*
* Input Parameters:
* hfwnd - A handle that will be used to access the toolbar. The toolbar
* must persist and this handle must be valid for the life of the NX
* console.
* wndo - Describes the window and font to be used
* minor - The device minor number
*
* Return:
* A non-NULL handle is returned on success.
*
****************************************************************************/
NXCONSOLE nxtool_register(NXTKWINDOW hfwnd, FAR struct nxcon_window_s *wndo, int minor)
{
return nxcon_register((NXCONSOLE)hfwnd, wndo, &g_nxtoolops, minor);
}

View File

@ -0,0 +1,173 @@
/****************************************************************************
* include/nuttx/nx/nxconsole.h
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_NX_NXCONSOLE_H
#define __INCLUDE_NUTTX_NX_NXCONSOLE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxtk.h>
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/* This is the handle that can be used to access the consoles */
typedef FAR void *NXCONSOLE;
/* This structure describes the window and font characteristics */
struct nxcon_window_s
{
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window background color */
nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */
struct nxgl_size_s wsize; /* Window size */
int fontid; /* The ID of the font to use */
};
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
# define EXTERN extern "C"
extern "C" {
#else
# define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: nx_register
*
* Description:
* Register a console device on a raw NX window. The device will be
* registered at /dev/nxconN where N is the provided minor number.
*
* Input Parameters:
* hwnd - A handle that will be used to access the window. The window must
* persist and this handle must be valid for the life of the NX console.
* wndo - Describes the window and font to be used
* minor - The device minor number
*
* Return:
* A non-NULL handle is returned on success.
*
****************************************************************************/
EXTERN NXCONSOLE nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo,
int minor);
/****************************************************************************
* Name: nxtk_register
*
* Description:
* Register a console device on a framed NX window. The device will be
* registered at /dev/nxconN where N is the provided minor number.
*
* Input Parameters:
* hfwnd - A handle that will be used to access the window. The window must
* persist and this handle must be valid for the life of the NX console.
* wndo - Describes the window and font to be used
* minor - The device minor number
*
* Return:
* A non-NULL handle is returned on success.
*
****************************************************************************/
EXTERN NXCONSOLE nxtk_register(NXTKWINDOW hfwnd,
FAR struct nxcon_window_s *wndo, int minor);
/****************************************************************************
* Name: nxtool_register
*
* Description:
* Register a console device on a toolbar of a framed NX window. The
* device will be registered at /dev/nxconN where N is the provided minor
* number.
*
* Input Parameters:
* hfwnd - A handle that will be used to access the toolbar. The toolbar
* must persist and this handle must be valid for the life of the NX
* console.
* wndo - Describes the window and font to be used
* minor - The device minor number
*
* Return:
* A non-NULL handle is returned on success.
*
****************************************************************************/
EXTERN NXCONSOLE nxtool_register(NXTKWINDOW hfwnd,
FAR struct nxcon_window_s *wndo, int minor);
/****************************************************************************
* Name: nxcon_unregister
*
* Description:
* Un-register to NX console device.
*
* Input Parameters:
* handle - A handle previously returned by nx_register, nxtk_register, or
* nxtool_register.
*
* Returned Value:
* None
*
****************************************************************************/
EXTERN void nxcon_unregister(NXCONSOLE handle);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __INCLUDE_NUTTX_NX_NXCONSOLE_H */