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

This commit is contained in:
Gregory Nutt 2017-10-14 10:55:12 -06:00
parent 8af55bbdcc
commit 273dd9dd3f
5 changed files with 48 additions and 214 deletions

View File

@ -1072,10 +1072,6 @@ examples/nx
CONFIG_NSH_BUILTIN_APPS -- Build the NX example as a "built-in" CONFIG_NSH_BUILTIN_APPS -- Build the NX example as a "built-in"
that can be executed from the NSH command line that can be executed from the NSH command line
CONFIG_EXAMPLES_NX_VPLANE -- The plane to select from the frame-
buffer driver for use in the test. Default: 0
CONFIG_EXAMPLES_NX_DEVNO - The LCD device to select from the LCD
driver for use in the test: Default: 0
CONFIG_EXAMPLES_NX_BGCOLOR -- The color of the background. Default depends on CONFIG_EXAMPLES_NX_BGCOLOR -- The color of the background. Default depends on
CONFIG_EXAMPLES_NX_BPP. CONFIG_EXAMPLES_NX_BPP.
CONFIG_EXAMPLES_NX_COLOR1 -- The color of window 1. Default depends on CONFIG_EXAMPLES_NX_COLOR1 -- The color of window 1. Default depends on
@ -1108,10 +1104,8 @@ examples/nx
CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface
will be available in order to access this function. will be available in order to access this function.
This test can be performed with either the single-user version of This test requires the multiple user vrsion of NX selected with
NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER. CONFIG_NX_MULTIUSER. Then the following configuration options also apply:
If CONFIG_NX_MULTIUSER is defined, then the following configuration
options also apply:
CONFIG_EXAMPLES_NX_STACKSIZE -- The stacksize to use when creating CONFIG_EXAMPLES_NX_STACKSIZE -- The stacksize to use when creating
the NX server. Default 2048 the NX server. Default 2048
@ -1122,8 +1116,8 @@ examples/nx
CONFIG_EXAMPLES_NX_NOTIFYSIGNO -- The signal number to use with CONFIG_EXAMPLES_NX_NOTIFYSIGNO -- The signal number to use with
nx_eventnotify(). Default: 4 nx_eventnotify(). Default: 4
If CONFIG_NX_MULTIUSER is defined, then the example also expects the The example also has the following settings and will generate an error
following settings and will generate an error if they are not as expected: if they are not as expected:
CONFIG_DISABLE_MQUEUE=n CONFIG_DISABLE_MQUEUE=n
CONFIG_DISABLE_SIGNALS=n CONFIG_DISABLE_SIGNALS=n

View File

@ -6,27 +6,12 @@
config EXAMPLES_NX config EXAMPLES_NX
bool "NX graphics example" bool "NX graphics example"
default n default n
depends on NX_MULTIUSER
---help--- ---help---
Enable the NX graphics example Enable the NX graphics example
if EXAMPLES_NX if EXAMPLES_NX
config EXAMPLES_NX_VPLANE
int "Video Plane"
default 0
depends on !NX_MULTIUSER
---help---
The plane to select from the framebuffer driver for use in the test.
Default: 0
config EXAMPLES_NX_DEVNO
int "Video Device Number"
default 0
depends on !NX_MULTIUSER
---help---
The LCD device to select from the LCD driver for use in the test:
Default: 0
config EXAMPLES_NX_DEFAULT_COLORS config EXAMPLES_NX_DEFAULT_COLORS
bool "Use Default Colors" bool "Use Default Colors"
default y default y
@ -96,7 +81,7 @@ config EXAMPLES_NX_EXTERNINIT
default n default n
depends on LIB_BOARDCTL depends on LIB_BOARDCTL
select BOARDCTL_GRAPHICS select BOARDCTL_GRAPHICS
select NXSTART_EXTERNINIT if NX_MULTIUSER select NXSTART_EXTERNINIT
---help--- ---help---
The driver for the graphics device on this platform requires some The driver for the graphics device on this platform requires some
unusual initialization. This is the for, for example, SPI LCD/OLED unusual initialization. This is the for, for example, SPI LCD/OLED
@ -113,8 +98,7 @@ config EXAMPLES_NX_EXTERNINIT
CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface
will be available in order to access this function. will be available in order to access this function.
if NX_MULTIUSER comment "NX Server Options"
comment "Multi-User Configuration Options"
config EXAMPLES_NX_STACKSIZE config EXAMPLES_NX_STACKSIZE
int "NX Server Stack Size" int "NX Server Stack Size"
@ -147,4 +131,3 @@ config EXAMPLES_NX_NOTIFYSIGNO
The signal number to use with nx_eventnotify(). Default: 4 The signal number to use with nx_eventnotify(). Default: 4
endif endif
endif

View File

@ -296,7 +296,6 @@ static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
* Name: nx_listenerthread * Name: nx_listenerthread
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NX_MULTIUSER
FAR void *nx_listenerthread(FAR void *arg) FAR void *nx_listenerthread(FAR void *arg)
{ {
int ret; int ret;
@ -334,4 +333,3 @@ FAR void *nx_listenerthread(FAR void *arg)
} }
} }
} }
#endif

View File

@ -126,34 +126,34 @@
# define CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT 16 # define CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT 16
#endif #endif
#ifdef CONFIG_NX_MULTIUSER /* NX Server Options */
# ifdef CONFIG_DISABLE_MQUEUE
#ifdef CONFIG_DISABLE_MQUEUE
# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)" # error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)"
# endif #endif
# ifdef CONFIG_DISABLE_SIGNALS #ifdef CONFIG_DISABLE_SIGNALS
# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)" # error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)"
# endif #endif
# ifdef CONFIG_DISABLE_PTHREAD #ifdef CONFIG_DISABLE_PTHREAD
# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)" # error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)"
# endif #endif
# ifndef CONFIG_NX_BLOCKING #ifndef CONFIG_NX_BLOCKING
# error "This example depends on CONFIG_NX_BLOCKING" # error "This example depends on CONFIG_NX_BLOCKING"
# endif #endif
# ifndef CONFIG_EXAMPLES_NX_STACKSIZE #ifndef CONFIG_EXAMPLES_NX_STACKSIZE
# define CONFIG_EXAMPLES_NX_STACKSIZE 2048 # define CONFIG_EXAMPLES_NX_STACKSIZE 2048
# endif #endif
# ifndef CONFIG_EXAMPLES_NX_LISTENERPRIO #ifndef CONFIG_EXAMPLES_NX_LISTENERPRIO
# define CONFIG_EXAMPLES_NX_LISTENERPRIO 100 # define CONFIG_EXAMPLES_NX_LISTENERPRIO 100
# endif #endif
# ifndef CONFIG_EXAMPLES_NX_CLIENTPRIO #ifndef CONFIG_EXAMPLES_NX_CLIENTPRIO
# define CONFIG_EXAMPLES_NX_CLIENTPRIO 100 # define CONFIG_EXAMPLES_NX_CLIENTPRIO 100
# endif #endif
# ifndef CONFIG_EXAMPLES_NX_SERVERPRIO #ifndef CONFIG_EXAMPLES_NX_SERVERPRIO
# define CONFIG_EXAMPLES_NX_SERVERPRIO 120 # define CONFIG_EXAMPLES_NX_SERVERPRIO 120
# endif #endif
# ifndef CONFIG_EXAMPLES_NX_NOTIFYSIGNO #ifndef CONFIG_EXAMPLES_NX_NOTIFYSIGNO
# define CONFIG_EXAMPLES_NX_NOTIFYSIGNO 4 # define CONFIG_EXAMPLES_NX_NOTIFYSIGNO 4
# endif
#endif #endif
#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS
@ -259,9 +259,7 @@ extern nxgl_coord_t g_xres;
extern nxgl_coord_t g_yres; extern nxgl_coord_t g_yres;
extern bool b_haveresolution; extern bool b_haveresolution;
#ifdef CONFIG_NX_MULTIUSER
extern bool g_connected; extern bool g_connected;
#endif
extern sem_t g_semevent; extern sem_t g_semevent;
/* Colors used to fill window 1 & 2 */ /* Colors used to fill window 1 & 2 */
@ -276,9 +274,7 @@ extern nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES];
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER)
FAR void *nx_listenerthread(FAR void *arg); FAR void *nx_listenerthread(FAR void *arg);
#endif
#ifdef CONFIG_NX_KBD #ifdef CONFIG_NX_KBD
void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg);

View File

@ -119,9 +119,7 @@ nxgl_coord_t g_xres;
nxgl_coord_t g_yres; nxgl_coord_t g_yres;
bool b_haveresolution = false; bool b_haveresolution = false;
#ifdef CONFIG_NX_MULTIUSER
bool g_connected = false; bool g_connected = false;
#endif
sem_t g_semevent = {0}; sem_t g_semevent = {0};
/* Colors used to fill window 1 & 2 */ /* Colors used to fill window 1 & 2 */
@ -412,129 +410,27 @@ static inline int nxeg_raise(NXEGWINDOW hwnd)
} }
#endif #endif
/****************************************************************************
* Name: nxeg_suinitialize
****************************************************************************/
#ifndef CONFIG_NX_MULTIUSER
static inline int nxeg_suinitialize(void)
{
FAR NX_DRIVERTYPE *dev;
int ret;
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
struct boardioc_graphics_s devinfo;
/* Use external graphics driver initialization */
printf("nxeg_initialize: Initializing external graphics device\n");
devinfo.devno = CONFIG_EXAMPLES_NX_DEVNO;
devinfo.dev = NULL;
ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
if (ret < 0)
{
printf("nxeg_initialize: boardctl failed, devno=%d: %d\n",
CONFIG_EXAMPLES_NX_DEVNO, errno);
g_exitcode = NXEXIT_EXTINITIALIZE;
return ERROR;
}
dev = devinfo.dev;
#elif defined(CONFIG_NX_LCDDRIVER)
/* Initialize the LCD device */
printf("nxeg_initialize: Initializing LCD\n");
ret = board_lcd_initialize();
if (ret < 0)
{
printf("nxeg_initialize: board_lcd_initialize failed: %d\n", -ret);
g_exitcode = NXEXIT_LCDINITIALIZE;
return ERROR;
}
/* Get the device instance */
dev = board_lcd_getdev(CONFIG_EXAMPLES_NX_DEVNO);
if (!dev)
{
printf("nxeg_initialize: board_lcd_getdev failed, devno=%d\n",
CONFIG_EXAMPLES_NX_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("nxeg_initialize: Initializing framebuffer\n");
ret = up_fbinitialize(0);
if (ret < 0)
{
printf("nxeg_initialize: up_fbinitialize failed: %d\n", -ret);
g_exitcode = NXEXIT_FBINITIALIZE;
return ERROR;
}
dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NX_VPLANE);
if (!dev)
{
printf("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NX_VPLANE);
g_exitcode = NXEXIT_FBGETVPLANE;
return ERROR;
}
#endif
/* Then open NX */
printf("nxeg_initialize: Open NX\n");
g_hnx = nx_open(dev);
if (!g_hnx)
{
printf("nxeg_suinitialize: 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: nxeg_initialize * Name: nxeg_initialize
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NX_MULTIUSER static int nxeg_initialize(void)
static inline int nxeg_muinitialize(void)
{ {
struct sched_param param; struct sched_param param;
pthread_t thread; pthread_t thread;
int ret; int ret;
int i;
/* Initialize window colors */
for (i = 0; i < CONFIG_NX_NPLANES; i++)
{
g_color1[i] = CONFIG_EXAMPLES_NX_COLOR1;
g_color2[i] = CONFIG_EXAMPLES_NX_COLOR2;
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
g_tbcolor[i] = CONFIG_EXAMPLES_NX_TBCOLOR;
#endif
}
/* Set the client task priority */ /* Set the client task priority */
@ -614,33 +510,6 @@ static inline int nxeg_muinitialize(void)
return OK; return OK;
} }
#endif
/****************************************************************************
* Name: nxeg_initialize
****************************************************************************/
static int nxeg_initialize(void)
{
int i;
/* Initialize window colors */
for (i = 0; i < CONFIG_NX_NPLANES; i++)
{
g_color1[i] = CONFIG_EXAMPLES_NX_COLOR1;
g_color2[i] = CONFIG_EXAMPLES_NX_COLOR2;
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
g_tbcolor[i] = CONFIG_EXAMPLES_NX_TBCOLOR;
#endif
}
#ifdef CONFIG_NX_MULTIUSER
return nxeg_muinitialize();
#else
return nxeg_suinitialize();
#endif
}
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -921,17 +790,11 @@ errout_with_hwnd1:
(void)nxeg_closewindow(hwnd1, &g_wstate[0]); (void)nxeg_closewindow(hwnd1, &g_wstate[0]);
errout_with_nx: errout_with_nx:
#ifdef CONFIG_NX_MULTIUSER
/* Disconnect from the server */ /* Disconnect from the server */
printf("nx_main: Disconnect from the server\n"); printf("nx_main: Disconnect from the server\n");
nx_disconnect(g_hnx); nx_disconnect(g_hnx);
#else
/* Close the window */
printf("nx_main: Close NX\n");
nx_close(g_hnx);
#endif
errout: errout:
return g_exitcode; return g_exitcode;
} }