Rename all occurences of NxConsole to NxTerm
This commit is contained in:
parent
d0fe4a6ec5
commit
45791a6029
@ -575,7 +575,7 @@ config NXWM_TOOLBAR_FONTID
|
||||
int "Toolbar Font ID"
|
||||
default 0
|
||||
---help---
|
||||
Use this default font ID in the NxConsole window instead of the
|
||||
Use this default font ID in the NxTerm window instead of the
|
||||
NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0 (maybe invalid)
|
||||
|
||||
endif # NXWM_TOOLBAR_CUSTOM_FONTID
|
||||
@ -675,55 +675,55 @@ config NXWM_STARTWINDOW_STACKSIZE
|
||||
|
||||
endmenu # Start Window Configuration
|
||||
|
||||
menu "NxConsole Window Settings"
|
||||
menu "NxTerm Window Settings"
|
||||
|
||||
config NXWM_NXTERM
|
||||
bool "NxConsole Window"
|
||||
bool "NxTerm Window"
|
||||
default y
|
||||
---help---
|
||||
Enable support for the NxConsole window which provides a text window
|
||||
Enable support for the NxTerm window which provides a text window
|
||||
in which you can interact with NSH.
|
||||
|
||||
if NXWM_NXTERM
|
||||
|
||||
config NXWM_NXTERM_PRIO
|
||||
int "NxConsole Task Priority"
|
||||
int "NxTerm Task Priority"
|
||||
default 100
|
||||
---help---
|
||||
Priority of the NxConsole task. Default: 100.
|
||||
Priority of the NxTerm task. Default: 100.
|
||||
|
||||
NOTE: This priority should be less than NXWIDGETS_SERVERPRIO or
|
||||
else there may be data overrun errors. Such errors would most likely
|
||||
appear as duplicated rows of data on the display.
|
||||
|
||||
config NXWM_NXTERM_STACKSIZE
|
||||
int "NxConsole Task Stack Size"
|
||||
int "NxTerm Task Stack Size"
|
||||
default 2048
|
||||
---help---
|
||||
The stack size to use when starting the NxConsole task. Default:
|
||||
The stack size to use when starting the NxTerm task. Default:
|
||||
2048 bytes.
|
||||
|
||||
config NXWM_NXTERM_CUSTOM_COLORS
|
||||
bool "Custom NxConsole Colors"
|
||||
bool "Custom NxTerm Colors"
|
||||
default n
|
||||
---help---
|
||||
Select custom default colors for the NxConsole window. If defined,
|
||||
the hexadecimal values for all NxConsole colors must be provided
|
||||
Select custom default colors for the NxTerm window. If defined,
|
||||
the hexadecimal values for all NxTerm colors must be provided
|
||||
(there are no default colors because the hexadecimal representation
|
||||
of the default colors depend on the pixel depth). Default: n
|
||||
|
||||
if NXWM_NXTERM_CUSTOM_COLORS
|
||||
|
||||
config NXWM_NXTERM_WCOLOR
|
||||
hex "NxConsole Background Color"
|
||||
hex "NxTerm Background Color"
|
||||
---help---
|
||||
The color of the NxConsole window background. Default:
|
||||
The color of the NxTerm window background. Default:
|
||||
RGB(192,192,192)
|
||||
|
||||
config NXWM_NXTERM_FONTCOLOR
|
||||
hex "NxConsole Font Color"
|
||||
hex "NxTerm Font Color"
|
||||
---help---
|
||||
The color of the fonts to use in the NxConsole window.
|
||||
The color of the fonts to use in the NxTerm window.
|
||||
Default: RGB(0,0,0)
|
||||
|
||||
endif # NXWM_NXTERM_CUSTOM_COLORS
|
||||
@ -737,31 +737,31 @@ config NXWM_NXTERM_CUSTOM_FONTID
|
||||
if NXWM_NXTERM_CUSTOM_FONTID
|
||||
|
||||
config NXWM_NXTERM_FONTID
|
||||
int "NxConsole Font ID"
|
||||
int "NxTerm Font ID"
|
||||
default 0
|
||||
---help---
|
||||
Use this default font ID in the NxConsole window instead of the
|
||||
Use this default font ID in the NxTerm window instead of the
|
||||
NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0
|
||||
|
||||
endif # NXWM_NXTERM_CUSTOM_FONTID
|
||||
|
||||
config NXWM_CUSTOM_NXTERM_ICON
|
||||
bool "Custom NxConsole Icon"
|
||||
bool "Custom NxTerm Icon"
|
||||
default n
|
||||
---help---
|
||||
Select to override the default NxConsole Window Icon: NxWM::g_cmdBitmap
|
||||
Select to override the default NxTerm Window Icon: NxWM::g_cmdBitmap
|
||||
|
||||
if NXWM_CUSTOM_NXTERM_ICON
|
||||
|
||||
config NXWM_NXTERM_ICON
|
||||
string "NxConsole Icon"
|
||||
string "NxTerm Icon"
|
||||
default "NxWM::g_cmdBitmap"
|
||||
---help---
|
||||
The glyph to use as the NxConsole icon. Default: NxWM::g_cmdBitmap
|
||||
The glyph to use as the NxTerm icon. Default: NxWM::g_cmdBitmap
|
||||
|
||||
endif # NXWM_NXTERM_ICON
|
||||
endif # NXWM_NXTERM
|
||||
endmenu # NxConsole Window Settings
|
||||
endmenu # NxTerm Window Settings
|
||||
|
||||
menu "NxWM Touchscreen Configuration"
|
||||
|
||||
|
@ -32,7 +32,7 @@ source "$APPSDIR/examples/nrf24l01_term/Kconfig"
|
||||
source "$APPSDIR/examples/nsh/Kconfig"
|
||||
source "$APPSDIR/examples/null/Kconfig"
|
||||
source "$APPSDIR/examples/nx/Kconfig"
|
||||
source "$APPSDIR/examples/nxconsole/Kconfig"
|
||||
source "$APPSDIR/examples/nxterm/Kconfig"
|
||||
source "$APPSDIR/examples/nxffs/Kconfig"
|
||||
source "$APPSDIR/examples/nxflat/Kconfig"
|
||||
source "$APPSDIR/examples/nxhello/Kconfig"
|
||||
|
@ -155,7 +155,7 @@ CONFIGURED_APPS += examples/nx
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_NXTERM),y)
|
||||
CONFIGURED_APPS += examples/nxconsole
|
||||
CONFIGURED_APPS += examples/nxterm
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_NXFFS),y)
|
||||
|
@ -40,7 +40,7 @@
|
||||
SUBDIRS = adc buttons can cc3000 cpuhog cxxtest dhcpd discover elf
|
||||
SUBDIRS += flash_test ftpc ftpd hello helloxx hidkbd igmp i2schar json
|
||||
SUBDIRS += keypadtest lcdrw mm modbus mount mtdpart netpkt nettest
|
||||
SUBDIRS += nrf24l01_term nsh null nx nxconsole nxffs nxflat nxhello nximage
|
||||
SUBDIRS += nrf24l01_term nsh null nx nxterm nxffs nxflat nxhello nximage
|
||||
SUBDIRS += nxlines nxtext ostest pashello pipe poll posix_spawn pwm qencoder
|
||||
SUBDIRS += random relays rgmp romfs sendmail serialblaster serloop serialrx
|
||||
SUBDIRS += slcd smart smart_test tcpecho telnetd thttpd tiff touchscreen udp
|
||||
|
@ -808,11 +808,11 @@ examples/nx
|
||||
CONFIG_DISABLE_PTHREAD=n
|
||||
CONFIG_NX_BLOCKING=y
|
||||
|
||||
examples/nxconsole
|
||||
examples/nxterm
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This directory contains yet another version of the NuttShell (NSH). This
|
||||
version uses the NX console device defined in include/nuttx/nx/nxconsole.h
|
||||
version uses the NX console device defined in include/nuttx/nx/nxterm.h
|
||||
for output. the result is that the NSH input still come from the standard
|
||||
console input (probably a serial console). But the text output will go to
|
||||
an NX winbdow. Prerequisite configuration settings for this test include:
|
||||
@ -864,10 +864,10 @@ examples/nxconsole
|
||||
CONFIG_EXAMPLES_NXCON_DEVNAME -- The quoated, full path to the
|
||||
NX console device corresponding to CONFIG_EXAMPLES_NXCON_MINOR.
|
||||
Default: "/dev/nxcon0"
|
||||
CONFIG_EXAMPLES_NXTERM_PRIO - Priority of the NxConsole task.
|
||||
CONFIG_EXAMPLES_NXTERM_PRIO - Priority of the NxTerm task.
|
||||
Default: SCHED_PRIORITY_DEFAULT
|
||||
CONFIG_EXAMPLES_NXTERM_STACKSIZE - Stack size allocated for the
|
||||
NxConsole task. Default: 2048
|
||||
NxTerm task. Default: 2048
|
||||
|
||||
The following configuration settings determine how to set up the NX
|
||||
server (CONFIG_NX_MULTIUSER):
|
||||
|
@ -1,189 +0,0 @@
|
||||
/****************************************************************************
|
||||
* examples/nxconsole/nxcon_server.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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
# include <nuttx/lcd/lcd.h>
|
||||
#else
|
||||
# include <nuttx/video/fb.h>
|
||||
#endif
|
||||
|
||||
#include "nxcon_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcon_server
|
||||
****************************************************************************/
|
||||
|
||||
int nxcon_server(int argc, char *argv[])
|
||||
{
|
||||
FAR NX_DRIVERTYPE *dev;
|
||||
int ret;
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_NXCON_EXTERNINIT)
|
||||
/* Use external graphics driver initialization */
|
||||
|
||||
message("nxcon_server: Initializing external graphics device\n");
|
||||
dev = up_nxdrvinit(CONFIG_EXAMPLES_NXCON_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
message("nxcon_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||
/* Initialize the LCD device */
|
||||
|
||||
message("nxcon_server: Initializing LCD\n");
|
||||
ret = up_lcdinitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_server: up_lcdinitialize failed: %d\n", -ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get the device instance */
|
||||
|
||||
dev = up_lcdgetdev(CONFIG_EXAMPLES_NXCON_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
message("nxcon_server: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO);
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Turn the LCD on at 75% power */
|
||||
|
||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||
#else
|
||||
/* Initialize the frame buffer device */
|
||||
|
||||
message("nxcon_server: Initializing framebuffer\n");
|
||||
ret = up_fbinitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_server: up_fbinitialize failed: %d\n", -ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXCON_VPLANE);
|
||||
if (!dev)
|
||||
{
|
||||
message("nxcon_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXCON_VPLANE);
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then start the server */
|
||||
|
||||
ret = nx_run(dev);
|
||||
gvdbg("nx_run returned: %d\n", errno);
|
||||
return 3;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcon_listener
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *nxcon_listener(FAR void *arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Process events forever */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Handle the next event. If we were configured blocking, then
|
||||
* we will stay right here until the next event is received. Since
|
||||
* we have dedicated a while thread to servicing events, it would
|
||||
* be most natural to also select CONFIG_NX_BLOCKING -- if not, the
|
||||
* following would be a tight infinite loop (unless we added addition
|
||||
* logic with nx_eventnotify and sigwait to pace it).
|
||||
*/
|
||||
|
||||
ret = nx_eventhandler(g_nxcon_vars.hnx);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* An error occurred... assume that we have lost connection with
|
||||
* the server.
|
||||
*/
|
||||
|
||||
message("nxcon_listener: Lost server connection: %d\n", errno);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* If we received a message, we must be connected */
|
||||
|
||||
if (!g_nxcon_vars.connected)
|
||||
{
|
||||
g_nxcon_vars.connected = true;
|
||||
sem_post(&g_nxcon_vars.eventsem);
|
||||
message("nxcon_listener: Connected\n");
|
||||
}
|
||||
}
|
||||
}
|
@ -4,10 +4,10 @@
|
||||
#
|
||||
|
||||
config EXAMPLES_NXTERM
|
||||
bool "NxConsole example"
|
||||
bool "NxTerm example"
|
||||
default n
|
||||
---help---
|
||||
Enable the NxConsole example
|
||||
Enable the NxTerm example
|
||||
|
||||
if EXAMPLES_NXTERM
|
||||
endif
|
@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# apps/examples/nxconsole/Makefile
|
||||
# apps/examples/nxterm/Makefile
|
||||
#
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -40,8 +40,8 @@ include $(APPDIR)/Make.defs
|
||||
# NuttX NX Console Example.
|
||||
|
||||
ASRCS =
|
||||
CSRCS = nxcon_toolbar.c nxcon_wndo.c nxcon_server.c
|
||||
MAINSRC = nxcon_main.c
|
||||
CSRCS = nxterm_toolbar.c nxterm_wndo.c nxterm_server.c
|
||||
MAINSRC = nxterm_main.c
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
@ -70,7 +70,7 @@ else
|
||||
INSTALL_DIR = $(BIN_DIR)
|
||||
endif
|
||||
|
||||
CONFIG_XYZ_PROGNAME ?= nxconsole$(EXEEXT)
|
||||
CONFIG_XYZ_PROGNAME ?= nxterm$(EXEEXT)
|
||||
PROGNAME = $(CONFIG_XYZ_PROGNAME)
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* examples/nxconsole/nxcon_internal.h
|
||||
* examples/nxterm/nxterm_internal.h
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -51,7 +51,7 @@
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nxtk.h>
|
||||
#include <nuttx/nx/nxconsole.h>
|
||||
#include <nuttx/nx/nxterm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -63,13 +63,13 @@
|
||||
# error "NX is not enabled (CONFIG_NX=y)"
|
||||
#endif
|
||||
|
||||
/* Can't do the NxConsole example if the NxConsole driver is not built */
|
||||
/* Can't do the NxTerm example if the NxTerm driver is not built */
|
||||
|
||||
#ifndef CONFIG_NXTERM
|
||||
# error "NxConsole is not enabled (CONFIG_NXTERM=y)"
|
||||
# error "NxTerm is not enabled (CONFIG_NXTERM=y)"
|
||||
#endif
|
||||
|
||||
/* NxConsole requires NX Multi-user mode */
|
||||
/* NxTerm requires NX Multi-user mode */
|
||||
|
||||
#ifndef CONFIG_NX_MULTIUSER
|
||||
# error "Multi-user NX support is required (CONFIG_NX_MULTIUSER=y)"
|
||||
@ -222,10 +222,10 @@
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NXCON_DEVNAME
|
||||
# define CONFIG_EXAMPLES_NXCON_DEVNAME "/dev/nxcon0"
|
||||
# define CONFIG_EXAMPLES_NXCON_DEVNAME "/dev/nxterm0"
|
||||
#endif
|
||||
|
||||
/* NxConsole task */
|
||||
/* NxTerm task */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NXTERM_PRIO
|
||||
# define CONFIG_EXAMPLES_NXTERM_PRIO SCHED_PRIORITY_DEFAULT
|
||||
@ -263,7 +263,7 @@
|
||||
* the chance of name collisions.
|
||||
*/
|
||||
|
||||
struct nxcon_state_s
|
||||
struct nxterm_state_s
|
||||
{
|
||||
volatile bool haveres; /* True: Have screen resolution */
|
||||
volatile bool connected; /* True: Connected to server */
|
||||
@ -271,8 +271,8 @@ struct nxcon_state_s
|
||||
pid_t pid; /* Console task ID */
|
||||
NXHANDLE hnx; /* The connection handler */
|
||||
NXTKWINDOW hwnd; /* The window */
|
||||
NXCONSOLE hdrvr; /* The console driver */
|
||||
struct nxcon_window_s wndo; /* Describes the window */
|
||||
NXTERM hdrvr; /* The console driver */
|
||||
struct nxterm_window_s wndo; /* Describes the window */
|
||||
nxgl_coord_t xres; /* Screen X resolution */
|
||||
nxgl_coord_t yres; /* Screen Y resolution */
|
||||
struct nxgl_size_s wsize; /* Window size */
|
||||
@ -286,11 +286,11 @@ struct nxcon_state_s
|
||||
* the chance of name collisions.
|
||||
*/
|
||||
|
||||
extern struct nxcon_state_s g_nxcon_vars;
|
||||
extern struct nxterm_state_s g_nxterm_vars;
|
||||
|
||||
/* NX callback vtables */
|
||||
|
||||
extern const struct nx_callback_s g_nxconcb;
|
||||
extern const struct nx_callback_s g_nxtermcb;
|
||||
extern const struct nx_callback_s g_nxtoolcb;
|
||||
|
||||
/****************************************************************************
|
||||
@ -304,7 +304,7 @@ extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno);
|
||||
|
||||
/* Server thread support */
|
||||
|
||||
extern int nxcon_server(int argc, char *argv[]);
|
||||
extern FAR void *nxcon_listener(FAR void *arg);
|
||||
extern int nxterm_server(int argc, char *argv[]);
|
||||
extern FAR void *nxterm_listener(FAR void *arg);
|
||||
|
||||
#endif /* __EXAMPLES_NXTERM_NXCON_INTERNAL_H */
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* examples/nxconsole/nxcon_main.c
|
||||
* examples/nxterm/nxterm_main.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -61,11 +61,11 @@
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nxfonts.h>
|
||||
#include <nuttx/nx/nxconsole.h>
|
||||
#include <nuttx/nx/nxterm.h>
|
||||
|
||||
#include <apps/nsh.h>
|
||||
|
||||
#include "nxcon_internal.h"
|
||||
#include "nxterm_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -91,17 +91,17 @@
|
||||
* the chance of name collisions.
|
||||
*/
|
||||
|
||||
struct nxcon_state_s g_nxcon_vars;
|
||||
struct nxterm_state_s g_nxterm_vars;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcon_initialize
|
||||
* Name: nxterm_initialize
|
||||
****************************************************************************/
|
||||
|
||||
static int nxcon_initialize(void)
|
||||
static int nxterm_initialize(void)
|
||||
{
|
||||
struct sched_param param;
|
||||
pthread_t thread;
|
||||
@ -114,18 +114,18 @@ static int nxcon_initialize(void)
|
||||
ret = sched_setparam(0, ¶m);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_initialize: sched_setparam failed: %d\n" , ret);
|
||||
message("nxterm_initialize: sched_setparam failed: %d\n" , ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Start the server task */
|
||||
|
||||
message("nxcon_initialize: Starting nxcon_server task\n");
|
||||
message("nxterm_initialize: Starting nxterm_server task\n");
|
||||
servrid = task_create("NX Server", CONFIG_EXAMPLES_NXCON_SERVERPRIO,
|
||||
CONFIG_EXAMPLES_NXCON_STACKSIZE, nxcon_server, NULL);
|
||||
CONFIG_EXAMPLES_NXCON_STACKSIZE, nxterm_server, NULL);
|
||||
if (servrid < 0)
|
||||
{
|
||||
message("nxcon_initialize: Failed to create nxcon_server task: %d\n", errno);
|
||||
message("nxterm_initialize: Failed to create nxterm_server task: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -135,8 +135,8 @@ static int nxcon_initialize(void)
|
||||
|
||||
/* Connect to the server */
|
||||
|
||||
g_nxcon_vars.hnx = nx_connect();
|
||||
if (g_nxcon_vars.hnx)
|
||||
g_nxterm_vars.hnx = nx_connect();
|
||||
if (g_nxterm_vars.hnx)
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
|
||||
@ -150,37 +150,37 @@ static int nxcon_initialize(void)
|
||||
(void)pthread_attr_setschedparam(&attr, ¶m);
|
||||
(void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXCON_STACKSIZE);
|
||||
|
||||
ret = pthread_create(&thread, &attr, nxcon_listener, NULL);
|
||||
ret = pthread_create(&thread, &attr, nxterm_listener, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
printf("nxcon_initialize: pthread_create failed: %d\n", ret);
|
||||
printf("nxterm_initialize: pthread_create failed: %d\n", ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Don't return until we are connected to the server */
|
||||
|
||||
while (!g_nxcon_vars.connected)
|
||||
while (!g_nxterm_vars.connected)
|
||||
{
|
||||
/* Wait for the listener thread to wake us up when we really
|
||||
* are connected.
|
||||
*/
|
||||
|
||||
(void)sem_wait(&g_nxcon_vars.eventsem);
|
||||
(void)sem_wait(&g_nxterm_vars.eventsem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message("nxcon_initialize: nx_connect failed: %d\n", errno);
|
||||
message("nxterm_initialize: nx_connect failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcon_task
|
||||
* Name: nxterm_task
|
||||
****************************************************************************/
|
||||
|
||||
static int nxcon_task(int argc, char **argv)
|
||||
static int nxterm_task(int argc, char **argv)
|
||||
{
|
||||
/* If the console front end is selected, then run it on this thread */
|
||||
|
||||
@ -188,16 +188,16 @@ static int nxcon_task(int argc, char **argv)
|
||||
(void)nsh_consolemain(0, NULL);
|
||||
#endif
|
||||
|
||||
printf("nxcon_task: Unregister the NX console device\n");
|
||||
(void)nxcon_unregister(g_nxcon_vars.hdrvr);
|
||||
printf("nxterm_task: Unregister the NX console device\n");
|
||||
(void)nxterm_unregister(g_nxterm_vars.hdrvr);
|
||||
|
||||
printf("nxcon_task: Close the window\n");
|
||||
(void)nxtk_closewindow(g_nxcon_vars.hwnd);
|
||||
printf("nxterm_task: Close the window\n");
|
||||
(void)nxtk_closewindow(g_nxterm_vars.hwnd);
|
||||
|
||||
/* Disconnect from the server */
|
||||
|
||||
printf("nxcon_task: Disconnect from the server\n");
|
||||
nx_disconnect(g_nxcon_vars.hnx);
|
||||
printf("nxterm_task: Disconnect from the server\n");
|
||||
nx_disconnect(g_nxterm_vars.hnx);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@ -207,13 +207,13 @@ static int nxcon_task(int argc, char **argv)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcon_main
|
||||
* Name: nxterm_main
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
int main(int argc, FAR char *argv[])
|
||||
#else
|
||||
int nxcon_main(int argc, char **argv)
|
||||
int nxterm_main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
nxgl_mxpixel_t color;
|
||||
@ -223,8 +223,8 @@ int nxcon_main(int argc, char **argv)
|
||||
/* General Initialization *************************************************/
|
||||
/* Reset all global data */
|
||||
|
||||
message("nxcon_main: Started\n");
|
||||
memset(&g_nxcon_vars, 0, sizeof(struct nxcon_state_s));
|
||||
message("nxterm_main: Started\n");
|
||||
memset(&g_nxterm_vars, 0, sizeof(struct nxterm_state_s));
|
||||
|
||||
/* Call all C++ static constructors */
|
||||
|
||||
@ -235,7 +235,7 @@ int nxcon_main(int argc, char **argv)
|
||||
/* NSH Initialization *****************************************************/
|
||||
/* Initialize the NSH library */
|
||||
|
||||
message("nxcon_main: Initialize NSH\n");
|
||||
message("nxterm_main: Initialize NSH\n");
|
||||
nsh_initialize();
|
||||
|
||||
/* If the Telnet console is selected as a front-end, then start the
|
||||
@ -256,87 +256,87 @@ int nxcon_main(int argc, char **argv)
|
||||
/* NX Initialization ******************************************************/
|
||||
/* Initialize NX */
|
||||
|
||||
message("nxcon_main: Initialize NX\n");
|
||||
ret = nxcon_initialize();
|
||||
message("nxcon_main: NX handle=%p\n", g_nxcon_vars.hnx);
|
||||
if (!g_nxcon_vars.hnx || ret < 0)
|
||||
message("nxterm_main: Initialize NX\n");
|
||||
ret = nxterm_initialize();
|
||||
message("nxterm_main: NX handle=%p\n", g_nxterm_vars.hnx);
|
||||
if (!g_nxterm_vars.hnx || ret < 0)
|
||||
{
|
||||
message("nxcon_main: Failed to get NX handle: %d\n", errno);
|
||||
message("nxterm_main: Failed to get NX handle: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Set the background to the configured background color */
|
||||
|
||||
message("nxcon_main: Set background color=%d\n", CONFIG_EXAMPLES_NXCON_BGCOLOR);
|
||||
message("nxterm_main: Set background color=%d\n", CONFIG_EXAMPLES_NXCON_BGCOLOR);
|
||||
color = CONFIG_EXAMPLES_NXCON_BGCOLOR;
|
||||
ret = nx_setbgcolor(g_nxcon_vars.hnx, &color);
|
||||
ret = nx_setbgcolor(g_nxterm_vars.hnx, &color);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_main: nx_setbgcolor failed: %d\n", errno);
|
||||
message("nxterm_main: nx_setbgcolor failed: %d\n", errno);
|
||||
goto errout_with_nx;
|
||||
}
|
||||
|
||||
/* Window Configuration ***************************************************/
|
||||
/* Create a window */
|
||||
|
||||
message("nxcon_main: Create window\n");
|
||||
g_nxcon_vars.hwnd = nxtk_openwindow(g_nxcon_vars.hnx, &g_nxconcb, NULL);
|
||||
if (!g_nxcon_vars.hwnd)
|
||||
message("nxterm_main: Create window\n");
|
||||
g_nxterm_vars.hwnd = nxtk_openwindow(g_nxterm_vars.hnx, &g_nxtermcb, NULL);
|
||||
if (!g_nxterm_vars.hwnd)
|
||||
{
|
||||
message("nxcon_main: nxtk_openwindow failed: %d\n", errno);
|
||||
message("nxterm_main: nxtk_openwindow failed: %d\n", errno);
|
||||
goto errout_with_nx;
|
||||
}
|
||||
message("nxcon_main: hwnd=%p\n", g_nxcon_vars.hwnd);
|
||||
message("nxterm_main: hwnd=%p\n", g_nxterm_vars.hwnd);
|
||||
|
||||
/* Wait until we have the screen resolution. We'll have this immediately
|
||||
* unless we are dealing with the NX server.
|
||||
*/
|
||||
|
||||
while (!g_nxcon_vars.haveres)
|
||||
while (!g_nxterm_vars.haveres)
|
||||
{
|
||||
(void)sem_wait(&g_nxcon_vars.eventsem);
|
||||
(void)sem_wait(&g_nxterm_vars.eventsem);
|
||||
}
|
||||
message("nxcon_main: Screen resolution (%d,%d)\n", g_nxcon_vars.xres, g_nxcon_vars.yres);
|
||||
message("nxterm_main: Screen resolution (%d,%d)\n", g_nxterm_vars.xres, g_nxterm_vars.yres);
|
||||
|
||||
/* Determine the size and position of the window */
|
||||
|
||||
g_nxcon_vars.wndo.wsize.w = g_nxcon_vars.xres / 2 + g_nxcon_vars.xres / 4;
|
||||
g_nxcon_vars.wndo.wsize.h = g_nxcon_vars.yres / 2 + g_nxcon_vars.yres / 4;
|
||||
g_nxterm_vars.wndo.wsize.w = g_nxterm_vars.xres / 2 + g_nxterm_vars.xres / 4;
|
||||
g_nxterm_vars.wndo.wsize.h = g_nxterm_vars.yres / 2 + g_nxterm_vars.yres / 4;
|
||||
|
||||
g_nxcon_vars.wpos.x = g_nxcon_vars.xres / 8;
|
||||
g_nxcon_vars.wpos.y = g_nxcon_vars.yres / 8;
|
||||
g_nxterm_vars.wpos.x = g_nxterm_vars.xres / 8;
|
||||
g_nxterm_vars.wpos.y = g_nxterm_vars.yres / 8;
|
||||
|
||||
/* Set the window position */
|
||||
|
||||
message("nxcon_main: Set window position to (%d,%d)\n",
|
||||
g_nxcon_vars.wpos.x, g_nxcon_vars.wpos.y);
|
||||
message("nxterm_main: Set window position to (%d,%d)\n",
|
||||
g_nxterm_vars.wpos.x, g_nxterm_vars.wpos.y);
|
||||
|
||||
ret = nxtk_setposition(g_nxcon_vars.hwnd, &g_nxcon_vars.wpos);
|
||||
ret = nxtk_setposition(g_nxterm_vars.hwnd, &g_nxterm_vars.wpos);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_main: nxtk_setposition failed: %d\n", errno);
|
||||
message("nxterm_main: nxtk_setposition failed: %d\n", errno);
|
||||
goto errout_with_hwnd;
|
||||
}
|
||||
|
||||
/* Set the window size */
|
||||
|
||||
message("nxcon_main: Set window size to (%d,%d)\n",
|
||||
g_nxcon_vars.wndo.wsize.w, g_nxcon_vars.wndo.wsize.h);
|
||||
message("nxterm_main: Set window size to (%d,%d)\n",
|
||||
g_nxterm_vars.wndo.wsize.w, g_nxterm_vars.wndo.wsize.h);
|
||||
|
||||
ret = nxtk_setsize(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo.wsize);
|
||||
ret = nxtk_setsize(g_nxterm_vars.hwnd, &g_nxterm_vars.wndo.wsize);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_main: nxtk_setsize failed: %d\n", errno);
|
||||
message("nxterm_main: nxtk_setsize failed: %d\n", errno);
|
||||
goto errout_with_hwnd;
|
||||
}
|
||||
|
||||
/* Open the toolbar */
|
||||
|
||||
message("nxcon_main: Add toolbar to window\n");
|
||||
ret = nxtk_opentoolbar(g_nxcon_vars.hwnd, CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT, &g_nxtoolcb, NULL);
|
||||
message("nxterm_main: Add toolbar to window\n");
|
||||
ret = nxtk_opentoolbar(g_nxterm_vars.hwnd, CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT, &g_nxtoolcb, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nxcon_main: nxtk_opentoolbar failed: %d\n", errno);
|
||||
message("nxterm_main: nxtk_opentoolbar failed: %d\n", errno);
|
||||
goto errout_with_hwnd;
|
||||
}
|
||||
|
||||
@ -344,26 +344,26 @@ int nxcon_main(int argc, char **argv)
|
||||
|
||||
sleep(2);
|
||||
|
||||
/* NxConsole Configuration ************************************************/
|
||||
/* NxTerm Configuration ************************************************/
|
||||
/* Use the window to create an NX console */
|
||||
|
||||
g_nxcon_vars.wndo.wcolor[0] = CONFIG_EXAMPLES_NXCON_WCOLOR;
|
||||
g_nxcon_vars.wndo.fcolor[0] = CONFIG_EXAMPLES_NXCON_FONTCOLOR;
|
||||
g_nxcon_vars.wndo.fontid = CONFIG_EXAMPLES_NXCON_FONTID;
|
||||
g_nxterm_vars.wndo.wcolor[0] = CONFIG_EXAMPLES_NXCON_WCOLOR;
|
||||
g_nxterm_vars.wndo.fcolor[0] = CONFIG_EXAMPLES_NXCON_FONTCOLOR;
|
||||
g_nxterm_vars.wndo.fontid = CONFIG_EXAMPLES_NXCON_FONTID;
|
||||
|
||||
g_nxcon_vars.hdrvr = nxtk_register(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo, CONFIG_EXAMPLES_NXCON_MINOR);
|
||||
if (!g_nxcon_vars.hdrvr)
|
||||
g_nxterm_vars.hdrvr = nxtk_register(g_nxterm_vars.hwnd, &g_nxterm_vars.wndo, CONFIG_EXAMPLES_NXCON_MINOR);
|
||||
if (!g_nxterm_vars.hdrvr)
|
||||
{
|
||||
message("nxcon_main: nxtk_register failed: %d\n", errno);
|
||||
message("nxterm_main: nxtk_register failed: %d\n", errno);
|
||||
goto errout_with_hwnd;
|
||||
}
|
||||
|
||||
/* Open the NxConsole driver */
|
||||
/* Open the NxTerm driver */
|
||||
|
||||
fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
message("nxcon_main: open %s read-only failed: %d\n",
|
||||
message("nxterm_main: open %s read-only failed: %d\n",
|
||||
CONFIG_EXAMPLES_NXCON_DEVNAME, errno);
|
||||
goto errout_with_driver;
|
||||
}
|
||||
@ -373,7 +373,7 @@ int nxcon_main(int argc, char **argv)
|
||||
* Note that stdin is retained (file descriptor 0, probably the the serial console).
|
||||
*/
|
||||
|
||||
message("nxcon_main: Starting the console task\n");
|
||||
message("nxterm_main: Starting the console task\n");
|
||||
msgflush();
|
||||
|
||||
(void)fflush(stdout);
|
||||
@ -393,24 +393,24 @@ int nxcon_main(int argc, char **argv)
|
||||
* from this task.
|
||||
*/
|
||||
|
||||
g_nxcon_vars.pid = task_create("NxConsole", CONFIG_EXAMPLES_NXTERM_PRIO,
|
||||
g_nxterm_vars.pid = task_create("NxTerm", CONFIG_EXAMPLES_NXTERM_PRIO,
|
||||
CONFIG_EXAMPLES_NXTERM_STACKSIZE,
|
||||
nxcon_task, NULL);
|
||||
ASSERT(g_nxcon_vars.pid > 0);
|
||||
nxterm_task, NULL);
|
||||
ASSERT(g_nxterm_vars.pid > 0);
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
/* Error Exits ************************************************************/
|
||||
|
||||
errout_with_driver:
|
||||
(void)nxcon_unregister(g_nxcon_vars.hdrvr);
|
||||
(void)nxterm_unregister(g_nxterm_vars.hdrvr);
|
||||
|
||||
errout_with_hwnd:
|
||||
(void)nxtk_closewindow(g_nxcon_vars.hwnd);
|
||||
(void)nxtk_closewindow(g_nxterm_vars.hwnd);
|
||||
|
||||
errout_with_nx:
|
||||
/* Disconnect from the server */
|
||||
|
||||
nx_disconnect(g_nxcon_vars.hnx);
|
||||
nx_disconnect(g_nxterm_vars.hnx);
|
||||
errout:
|
||||
return EXIT_FAILURE;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* examples/nxconsole/nxcon_toolbar.c
|
||||
* examples/nxterm/nxterm_toolbar.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -51,7 +51,7 @@
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxfonts.h>
|
||||
|
||||
#include "nxcon_internal.h"
|
||||
#include "nxterm_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* examples/nxconsole/nxcon_wndo.c
|
||||
* examples/nxterm/nxterm_wndo.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -52,7 +52,7 @@
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxfonts.h>
|
||||
|
||||
#include "nxcon_internal.h"
|
||||
#include "nxterm_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -92,7 +92,7 @@ static void nxwndo_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
|
||||
|
||||
/* Background window call table */
|
||||
|
||||
const struct nx_callback_s g_nxconcb =
|
||||
const struct nx_callback_s g_nxtermcb =
|
||||
{
|
||||
nxwndo_redraw, /* redraw */
|
||||
nxwndo_position /* position */
|
||||
@ -123,11 +123,11 @@ static void nxwndo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
|
||||
/* Don't attempt to redraw if the driver has not yet been opened */
|
||||
|
||||
if (g_nxcon_vars.hdrvr)
|
||||
if (g_nxterm_vars.hdrvr)
|
||||
{
|
||||
/* Inform the NX console of the redraw request */
|
||||
|
||||
nxcon_redraw(g_nxcon_vars.hdrvr, rect, more);
|
||||
nxterm_redraw(g_nxterm_vars.hdrvr, rect, more);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -155,25 +155,25 @@ static void nxwndo_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
|
||||
|
||||
/* Have we picked off the window bounds yet? */
|
||||
|
||||
if (!g_nxcon_vars.haveres)
|
||||
if (!g_nxterm_vars.haveres)
|
||||
{
|
||||
/* Save the background window handle */
|
||||
|
||||
g_nxcon_vars.hwnd = hwnd;
|
||||
g_nxterm_vars.hwnd = hwnd;
|
||||
|
||||
/* Save the background window size */
|
||||
|
||||
g_nxcon_vars.wndo.wsize.w = size->w;
|
||||
g_nxcon_vars.wndo.wsize.h = size->h;
|
||||
g_nxterm_vars.wndo.wsize.w = size->w;
|
||||
g_nxterm_vars.wndo.wsize.h = size->h;
|
||||
|
||||
/* Save the window limits (these should be the same for all places and all windows */
|
||||
|
||||
g_nxcon_vars.xres = bounds->pt2.x + 1;
|
||||
g_nxcon_vars.yres = bounds->pt2.y + 1;
|
||||
g_nxterm_vars.xres = bounds->pt2.x + 1;
|
||||
g_nxterm_vars.yres = bounds->pt2.y + 1;
|
||||
|
||||
g_nxcon_vars.haveres = true;
|
||||
sem_post(&g_nxcon_vars.eventsem);
|
||||
gvdbg("Have xres=%d yres=%d\n", g_nxcon_vars.xres, g_nxcon_vars.yres);
|
||||
g_nxterm_vars.haveres = true;
|
||||
sem_post(&g_nxterm_vars.eventsem);
|
||||
gvdbg("Have xres=%d yres=%d\n", g_nxterm_vars.xres, g_nxterm_vars.yres);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user