examples/nxtext: The nxtext example no longer supports single user mode.

This commit is contained in:
Gregory Nutt 2017-10-14 11:16:34 -06:00
parent 25ee1352ef
commit 97e789976e
6 changed files with 35 additions and 207 deletions

View File

@ -1375,10 +1375,6 @@ examples/nxtext
CONFIG_NSH_BUILTIN_APPS -- Build the NXTEXT example as a "built-in"
that can be executed from the NSH command line
CONFIG_EXAMPLES_NXTEXT_VPLANE -- The plane to select from the frame-
buffer driver for use in the test. Default: 0
CONFIG_EXAMPLES_NXTEXT_DEVNO - The LCD device to select from the LCD
driver for use in the test: Default: 0
CONFIG_EXAMPLES_NXTEXT_BGCOLOR -- The color of the background. Default
depends on CONFIG_EXAMPLES_NXTEXT_BPP.
CONFIG_EXAMPLES_NXTEXT_BGFONTID - Selects the font to use in the
@ -1417,10 +1413,9 @@ examples/nxtext
CONFIG_EXAMPLES_NXTEXT_GLCACHE - The maximum nuber of pre-rendered
fonts that can be retained for the background window.
This test can be performed with either the single-user version of
NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER.
If CONFIG_NX_MULTIUSER is defined, then the following configuration
options also apply:
This test must be performed with the multiple user version of NX selected
with CONFIG_NX_MULTIUSER=y. The following configuration options also
apply:
CONFIG_EXAMPLES_NXTEXT_STACKSIZE -- The stacksize to use when creating
the NX server. Default 2048
@ -1431,8 +1426,8 @@ examples/nxtext
CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO -- The signal number to use with
nx_eventnotify(). Default: 4
If CONFIG_NX_MULTIUSER is defined, then the example also expects the
following settings and will generate an error if they are not as expected:
The example also expects the following settings and will generate an
error if they are not as expected:
CONFIG_DISABLE_MQUEUE=n
CONFIG_DISABLE_SIGNALS=n

View File

@ -6,6 +6,7 @@
config EXAMPLES_NXTEXT
bool "NX graphics text example"
default n
depends on NX_MULTIUSER
---help---
Enable the NX graphics text example
@ -13,20 +14,6 @@ if EXAMPLES_NXTEXT
comment "Basic Configuration of the example"
config EXAMPLES_NXTEXT_VPLANE
int "Video Plane"
default 0
---help---
The plane to select from the framebuffer driver for use in the test.
Default: 0
config EXAMPLES_NXTEXT_DEVNO
int "Video Device Number"
default 0
---help---
The LCD device to select from the LCD driver for use in the test:
Default: 0
config EXAMPLES_NXTEXT_BPP
int "Bits-Per-Pixel"
default 32
@ -138,9 +125,7 @@ config EXAMPLES_NXTEXT_EXTERNINIT
CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface
will be available in order to access this function.
if NX_MULTIUSER
comment "Multi-User Configuration Options"
comment "NX Server Options"
config EXAMPLES_NXTEXT_STACKSIZE
int "Listener Stack Size"
@ -160,5 +145,4 @@ config EXAMPLES_NXTEXT_CLIENTPRIO
---help---
The client priority. Default: 100
endif # NX_MULTIUSER
endif # EXAMPLES_NXTEXT

View File

@ -1,7 +1,7 @@
############################################################################
# apps/examples/nxtext/Makefile
#
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -39,14 +39,10 @@
ASRCS =
CSRCS = nxtext_bkgd.c nxtext_popup.c nxtext_putc.c
MAINSRC = nxtext_main.c
MAINSRC = nxtext_main.c nxtext_listener.c
ifeq ($(CONFIG_NX_MULTIUSER),y)
CSRCS += nxtext_listener.c
endif
CONFIG_XYZ_PROGNAME ?= nxtext$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
CONFIG_EXAMPLES_NXTERM_PROGNAME ?= nxtext$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_NXTERM_PROGNAME)
# NXTEXT built-in application info

View File

@ -165,30 +165,28 @@
# define CONFIG_EXAMPLES_NXTEXT_GLCACHE 16
#endif
/* NX muli-user mode */
/* NX Server Configuration */
#ifdef CONFIG_NX_MULTIUSER
# ifdef CONFIG_DISABLE_MQUEUE
# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)"
# endif
# ifdef CONFIG_DISABLE_SIGNALS
# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)"
# endif
# ifdef CONFIG_DISABLE_PTHREAD
# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)"
# endif
# ifndef CONFIG_NX_BLOCKING
# error "This example depends on CONFIG_NX_BLOCKING"
# endif
# ifndef CONFIG_EXAMPLES_NXTEXT_STACKSIZE
# define CONFIG_EXAMPLES_NXTEXT_STACKSIZE 2048
# endif
# ifndef CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO
# define CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO 100
# endif
# ifndef CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO
# define CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO 100
# endif
#ifdef CONFIG_DISABLE_MQUEUE
# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)"
#endif
#ifdef CONFIG_DISABLE_SIGNALS
# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)"
#endif
#ifdef CONFIG_DISABLE_PTHREAD
# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)"
#endif
#ifndef CONFIG_NX_BLOCKING
# error "This example depends on CONFIG_NX_BLOCKING"
#endif
#ifndef CONFIG_EXAMPLES_NXTEXT_STACKSIZE
# define CONFIG_EXAMPLES_NXTEXT_STACKSIZE 2048
#endif
#ifndef CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO
# define CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO 100
#endif
#ifndef CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO
# define CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO 100
#endif
/* Bitmap flags */
@ -304,9 +302,7 @@ extern nxgl_coord_t g_xres;
extern nxgl_coord_t g_yres;
extern bool b_haveresolution;
#ifdef CONFIG_NX_MULTIUSER
extern bool g_connected;
#endif
extern sem_t g_semevent;
extern int g_exitcode;
@ -315,9 +311,7 @@ extern int g_exitcode;
* Public Function Prototypes
****************************************************************************/
#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER)
FAR void *nxtext_listener(FAR void *arg);
#endif
/* Background window interfaces */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/nxtext/nxtext_listener.c
*
* Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -47,8 +47,6 @@
#include "nxtext_internal.h"
#ifdef CONFIG_NX_MULTIUSER
/****************************************************************************
* Public Functions
****************************************************************************/
@ -94,5 +92,3 @@ FAR void *nxtext_listener(FAR void *arg)
}
}
}
#endif /* CONFIG_NX_MULTIUSER */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/nxtext/nxtext_main.c
*
* Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -153,9 +153,7 @@ nxgl_coord_t g_xres;
nxgl_coord_t g_yres;
bool b_haveresolution = false;
#ifdef CONFIG_NX_MULTIUSER
bool g_connected = false;
#endif
sem_t g_semevent = {0};
int g_exitcode = NXEXIT_SUCCESS;
@ -164,126 +162,11 @@ int g_exitcode = NXEXIT_SUCCESS;
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: nxtext_suinitialize
****************************************************************************/
#ifndef CONFIG_NX_MULTIUSER
static inline int nxtext_suinitialize(void)
{
FAR NX_DRIVERTYPE *dev;
int ret;
#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT)
struct boardioc_graphics_s devinfo;
/* Use external graphics driver initialization */
printf("nxtext_initialize: Initializing external graphics device\n");
devinfo.devno = CONFIG_EXAMPLES_NXTEXT_DEVNO;
devinfo.dev = NULL;
ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
if (ret < 0)
{
printf("nxtext_initialize: boardctl failed, devno=%d: %d\n",
CONFIG_EXAMPLES_NXTEXT_DEVNO, errno);
g_exitcode = NXEXIT_EXTINITIALIZE;
return ERROR;
}
dev = devinfo.dev;
#elif defined(CONFIG_NX_LCDDRIVER)
/* Initialize the LCD device */
printf("nxtext_initialize: Initializing LCD\n");
ret = board_lcd_initialize();
if (ret < 0)
{
printf("nxtext_initialize: board_lcd_initialize failed: %d\n", -ret);
g_exitcode = NXEXIT_LCDINITIALIZE;
return ERROR;
}
/* Get the device instance */
dev = board_lcd_getdev(CONFIG_EXAMPLES_NXTEXT_DEVNO);
if (!dev)
{
printf("nxtext_initialize: board_lcd_getdev failed, devno=%d\n",
CONFIG_EXAMPLES_NXTEXT_DEVNO);
g_exitcode = NXEXIT_LCDGETDEV;
return ERROR;
}
/* Turn the LCD on at 75% power */
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
#else
/* Initialize the frame buffer device */
printf("nxtext_initialize: Initializing framebuffer\n");
ret = up_fbinitialize(0);
if (ret < 0)
{
printf("nxtext_initialize: up_fbinitialize failed: %d\n", -ret);
g_exitcode = NXEXIT_FBINITIALIZE;
return ERROR;
}
dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXTEXT_VPLANE);
if (!dev)
{
printf("nxtext_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXTEXT_VPLANE);
g_exitcode = NXEXIT_FBGETVPLANE;
return ERROR;
}
#endif
/* Then open NX */
printf("nxtext_initialize: Open NX\n");
g_hnx = nx_open(dev);
if (!g_hnx)
{
printf("nxtext_initialize: nx_open failed: %d\n", errno);
g_exitcode = NXEXIT_NXOPEN;
return ERROR;
}
#ifdef CONFIG_VNCSERVER
/* Setup the VNC server to support keyboard/mouse inputs */
ret = vnc_default_fbinitialize(0, g_hnx);
if (ret < 0)
{
printf("vnc_default_fbinitialize failed: %d\n", ret);
nx_close(g_hnx);
g_exitcode = NXEXIT_FBINITIALIZE;
return ERROR;
}
#endif
return OK;
}
#endif
/****************************************************************************
* Name: nxtext_initialize
****************************************************************************/
#ifdef CONFIG_NX_MULTIUSER
static inline int nxtext_muinitialize(void)
static int nxtext_initialize(void)
{
struct sched_param param;
pthread_t thread;
@ -370,20 +253,6 @@ static inline int nxtext_muinitialize(void)
return OK;
}
#endif
/****************************************************************************
* Name: nxtext_initialize
****************************************************************************/
static int nxtext_initialize(void)
{
#ifdef CONFIG_NX_MULTIUSER
return nxtext_muinitialize();
#else
return nxtext_suinitialize();
#endif
}
/****************************************************************************
* Public Functions
@ -539,17 +408,11 @@ errout_with_hwnd:
(void)nx_releasebkgd(g_bgwnd);
errout_with_nx:
#ifdef CONFIG_NX_MULTIUSER
/* Disconnect from the server */
printf("nxtext_main: Disconnect from the server\n");
nx_disconnect(g_hnx);
#else
/* Close the server */
printf("nxtext_main: Close NX\n");
nx_close(g_hnx);
#endif
errout:
return g_exitcode;
}