mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
More naming changes to get the stm3240g-eval/nxterm configuration building again
This commit is contained in:
@@ -3426,7 +3426,7 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
|
|||||||
<dt><code>CONFIG_NXTERM_NXKBDIN</code>:
|
<dt><code>CONFIG_NXTERM_NXKBDIN</code>:
|
||||||
<dd>Take input from the NX keyboard input callback.
|
<dd>Take input from the NX keyboard input callback.
|
||||||
By default, keyboard input is taken from stdin (<code>/dev/console</code>).
|
By default, keyboard input is taken from stdin (<code>/dev/console</code>).
|
||||||
If this option is set, then the interface<code>nxcon_kdbin()</code> is enabled.
|
If this option is set, then the interface<code>nxterm_kdbin()</code> is enabled.
|
||||||
That interface may be driven by window callback functions so that keyboard input <i>only</i> goes to the top window.
|
That interface may be driven by window callback functions so that keyboard input <i>only</i> goes to the top window.
|
||||||
<dt><code>CONFIG__NXTERM_KBDBUFSIZE</code>:
|
<dt><code>CONFIG__NXTERM_KBDBUFSIZE</code>:
|
||||||
<dd>If <code>CONFIG_NXTERM_NXKBDIN</code> is enabled, then this value may be used to
|
<dd>If <code>CONFIG_NXTERM_NXKBDIN</code> is enabled, then this value may be used to
|
||||||
|
|||||||
@@ -85,16 +85,17 @@ static inline void putreg16(uint16_t val, unsigned int addr)
|
|||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Atomic modification of registers */
|
/* Atomic modification of registers */
|
||||||
|
|
||||||
EXTERN void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits);
|
void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits);
|
||||||
EXTERN void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits);
|
void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits);
|
||||||
EXTERN void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
|
void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|||||||
@@ -1601,21 +1601,24 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
struct stm32_i2c_inst_s *inst = (struct stm32_i2c_inst_s *)dev;
|
struct stm32_i2c_inst_s *inst = (struct stm32_i2c_inst_s *)dev;
|
||||||
FAR struct stm32_i2c_priv_s *priv = inst->priv;
|
FAR struct stm32_i2c_priv_s *priv = inst->priv;
|
||||||
uint32_t status = 0;
|
uint32_t status = 0;
|
||||||
|
#ifdef I2C1_FSMC_CONFLICT
|
||||||
uint32_t ahbenr;
|
uint32_t ahbenr;
|
||||||
|
#endif
|
||||||
int errval = 0;
|
int errval = 0;
|
||||||
|
|
||||||
ASSERT(count);
|
ASSERT(count);
|
||||||
|
|
||||||
|
#ifdef I2C1_FSMC_CONFLICT
|
||||||
/* Disable FSMC that shares a pin with I2C1 (LBAR) */
|
/* Disable FSMC that shares a pin with I2C1 (LBAR) */
|
||||||
|
|
||||||
ahbenr = stm32_i2c_disablefsmc(priv);
|
ahbenr = stm32_i2c_disablefsmc(priv);
|
||||||
|
|
||||||
|
#else
|
||||||
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
||||||
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
||||||
* will not complete normally if the FSMC is enabled.
|
* will not complete normally if the FSMC is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef I2C1_FSMC_CONFLICT
|
|
||||||
stm32_i2c_sem_waitstop(priv);
|
stm32_i2c_sem_waitstop(priv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1755,18 +1758,18 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
|
|
||||||
stm32_i2c_tracedump(priv);
|
stm32_i2c_tracedump(priv);
|
||||||
|
|
||||||
|
#ifdef I2C1_FSMC_CONFLICT
|
||||||
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
||||||
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
||||||
* will not complete normally if the FSMC is enabled.
|
* will not complete normally if the FSMC is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef I2C1_FSMC_CONFLICT
|
|
||||||
stm32_i2c_sem_waitstop(priv);
|
stm32_i2c_sem_waitstop(priv);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Re-enable the FSMC */
|
/* Re-enable the FSMC */
|
||||||
|
|
||||||
stm32_i2c_enablefsmc(ahbenr);
|
stm32_i2c_enablefsmc(ahbenr);
|
||||||
|
#endif
|
||||||
stm32_i2c_sem_post(dev);
|
stm32_i2c_sem_post(dev);
|
||||||
|
|
||||||
return -errval;
|
return -errval;
|
||||||
|
|||||||
@@ -2103,21 +2103,24 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
struct stm32_i2c_inst_s *inst = (struct stm32_i2c_inst_s *)dev;
|
struct stm32_i2c_inst_s *inst = (struct stm32_i2c_inst_s *)dev;
|
||||||
FAR struct stm32_i2c_priv_s *priv = inst->priv;
|
FAR struct stm32_i2c_priv_s *priv = inst->priv;
|
||||||
uint32_t status = 0;
|
uint32_t status = 0;
|
||||||
|
#ifdef I2C1_FSMC_CONFLICT
|
||||||
uint32_t ahbenr;
|
uint32_t ahbenr;
|
||||||
|
#endif
|
||||||
int errval = 0;
|
int errval = 0;
|
||||||
|
|
||||||
ASSERT(count);
|
ASSERT(count);
|
||||||
|
|
||||||
|
#ifdef I2C1_FSMC_CONFLICT
|
||||||
/* Disable FSMC that shares a pin with I2C1 (LBAR) */
|
/* Disable FSMC that shares a pin with I2C1 (LBAR) */
|
||||||
|
|
||||||
ahbenr = stm32_i2c_disablefsmc(priv);
|
ahbenr = stm32_i2c_disablefsmc(priv);
|
||||||
|
|
||||||
|
#else
|
||||||
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
||||||
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
||||||
* will not complete normally if the FSMC is enabled.
|
* will not complete normally if the FSMC is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef I2C1_FSMC_CONFLICT
|
|
||||||
stm32_i2c_sem_waitstop(priv);
|
stm32_i2c_sem_waitstop(priv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2283,18 +2286,18 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
|
|
||||||
stm32_i2c_tracedump(priv);
|
stm32_i2c_tracedump(priv);
|
||||||
|
|
||||||
|
#ifdef I2C1_FSMC_CONFLICT
|
||||||
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
/* Wait for any STOP in progress. NOTE: If we have to disable the FSMC
|
||||||
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
* then we cannot do this at the top of the loop, unfortunately. The STOP
|
||||||
* will not complete normally if the FSMC is enabled.
|
* will not complete normally if the FSMC is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef I2C1_FSMC_CONFLICT
|
|
||||||
stm32_i2c_sem_waitstop(priv);
|
stm32_i2c_sem_waitstop(priv);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Re-enable the FSMC */
|
/* Re-enable the FSMC */
|
||||||
|
|
||||||
stm32_i2c_enablefsmc(ahbenr);
|
stm32_i2c_enablefsmc(ahbenr);
|
||||||
|
#endif
|
||||||
stm32_i2c_sem_post(dev);
|
stm32_i2c_sem_post(dev);
|
||||||
|
|
||||||
return -errval;
|
return -errval;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Preprocessor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Some sanity checks *******************************************************/
|
/* Some sanity checks *******************************************************/
|
||||||
/* DMA configuration */
|
/* DMA configuration */
|
||||||
@@ -1308,8 +1308,6 @@ static void up_set_format(struct uart_dev_s *dev)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
up_serialout(priv, STM32_USART_CR3_OFFSET, regval);
|
up_serialout(priv, STM32_USART_CR3_OFFSET, regval);
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
|
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
|
||||||
|
|
||||||
@@ -1327,7 +1325,7 @@ static void up_set_format(struct uart_dev_s *dev)
|
|||||||
|
|
||||||
static void up_set_apb_clock(struct uart_dev_s *dev, bool on)
|
static void up_set_apb_clock(struct uart_dev_s *dev, bool on)
|
||||||
{
|
{
|
||||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||||
uint32_t rcc_en;
|
uint32_t rcc_en;
|
||||||
uint32_t regaddr;
|
uint32_t regaddr;
|
||||||
|
|
||||||
@@ -2331,7 +2329,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
|
|||||||
* Name: up_txready
|
* Name: up_txready
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return true if the tranmsit data register is empty
|
* Return true if the transmit data register is empty
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -2530,6 +2528,7 @@ static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* HAVE_UART */
|
||||||
#endif /* USE_SERIALDRIVER */
|
#endif /* USE_SERIALDRIVER */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
/************************************************************************************
|
||||||
* configs/stm3240g-eval/include/board.h
|
* configs/stm3240g-eval/include/board.h
|
||||||
* include/arch/board/board.h
|
* include/arch/board/board.h
|
||||||
*
|
*
|
||||||
@@ -42,22 +42,24 @@
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "stm32_rcc.h"
|
#include "stm32_rcc.h"
|
||||||
#include "stm32_sdio.h"
|
#include "stm32_sdio.h"
|
||||||
#include "stm32.h"
|
#include "stm32.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Definitions
|
* Pre-processor Definitions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/* Clocking *************************************************************************/
|
/* Clocking *************************************************************************/
|
||||||
/* Four clock sources are available on STM3240G-EVAL evaluation board for
|
/* Four clock sources are available on STM3240G-EVAL evaluation board for
|
||||||
* STM32F407IGH6 and RTC embedded:
|
* STM32F407IGH6 and RTC embedded:
|
||||||
*
|
*
|
||||||
* X1, 25 MHz crystal for ethernet PHY with socket. It can be removed when clock is
|
* X1, 25 MHz crystal for Ethernet PHY with socket. It can be removed when clock is
|
||||||
* provided by MCO pin of the MCU
|
* provided by MCO pin of the MCU
|
||||||
* X2, 26 MHz crystal for USB OTG HS PHY
|
* X2, 26 MHz crystal for USB OTG HS PHY
|
||||||
* X3, 32 kHz crystal for embedded RTC
|
* X3, 32 kHz crystal for embedded RTC
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ CONFIG_SCHED_WAITPID=y
|
|||||||
# CONFIG_SCHED_STARTHOOK is not set
|
# CONFIG_SCHED_STARTHOOK is not set
|
||||||
# CONFIG_SCHED_ATEXIT is not set
|
# CONFIG_SCHED_ATEXIT is not set
|
||||||
# CONFIG_SCHED_ONEXIT is not set
|
# CONFIG_SCHED_ONEXIT is not set
|
||||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
CONFIG_USER_ENTRYPOINT="nxterm_main"
|
||||||
CONFIG_DISABLE_OS_API=y
|
CONFIG_DISABLE_OS_API=y
|
||||||
# CONFIG_DISABLE_POSIX_TIMERS is not set
|
# CONFIG_DISABLE_POSIX_TIMERS is not set
|
||||||
# CONFIG_DISABLE_PTHREAD is not set
|
# CONFIG_DISABLE_PTHREAD is not set
|
||||||
|
|||||||
+1
-1
@@ -436,7 +436,7 @@ config NXTERM_NXKBDIN
|
|||||||
---help---
|
---help---
|
||||||
Take input from the NX keyboard input callback. By default, keyboard
|
Take input from the NX keyboard input callback. By default, keyboard
|
||||||
input is taken from stdin (/dev/console). If this option is set, then
|
input is taken from stdin (/dev/console). If this option is set, then
|
||||||
the interface nxcon_kdbin() is enabled. That interface may be driven
|
the interface nxterm_kdbin() is enabled. That interface may be driven
|
||||||
by window callback functions so that keyboard input *only* goes to the
|
by window callback functions so that keyboard input *only* goes to the
|
||||||
top window.
|
top window.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -65,10 +65,10 @@ DEPPATH += --dep-path nxterm
|
|||||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxterm}
|
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxterm}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXCON_ASRCS)
|
ASRCS = $(NXGLIB_ASRCS) $(NXBE_ASRCS) $(NX_ASRCS) $(NXTK_ASRCS) $(NXTERM_ASRCS)
|
||||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||||
|
|
||||||
CSRCS = $(NXGLIB_CSRCS) $(NXBE_CSRCS) $(NX_CSRCS) $(NXTK_CSRCS) $(NXCON_CSRCS)
|
CSRCS = $(NXGLIB_CSRCS) $(NXBE_CSRCS) $(NX_CSRCS) $(NXTK_CSRCS) $(NXTERM_CSRCS)
|
||||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
SRCS = $(ASRCS) $(CSRCS)
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
|
|||||||
+1
-1
@@ -396,7 +396,7 @@ NxTerm Input options
|
|||||||
CONFIG_NXTERM_NXKBDIN
|
CONFIG_NXTERM_NXKBDIN
|
||||||
Take input from the NX keyboard input callback. By default, keyboard
|
Take input from the NX keyboard input callback. By default, keyboard
|
||||||
input is taken from stdin (/dev/console). If this option is set, then
|
input is taken from stdin (/dev/console). If this option is set, then
|
||||||
the interface nxcon_kdbin() is enabled. That interface may be driven
|
the interface nxterm_kdbin() is enabled. That interface may be driven
|
||||||
by window callback functions so that keyboard input *only* goes to the
|
by window callback functions so that keyboard input *only* goes to the
|
||||||
top window.
|
top window.
|
||||||
CONFIG__NXTERM_KBDBUFSIZE
|
CONFIG__NXTERM_KBDBUFSIZE
|
||||||
|
|||||||
@@ -33,16 +33,16 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
NXCON_ASRCS =
|
NXTERM_ASRCS =
|
||||||
NXCON_CSRCS = nx_register.c nxcon_driver.c nxcon_font.c nxcon_putc.c
|
NXTERM_CSRCS = nx_register.c nxterm_driver.c nxterm_font.c nxterm_putc.c
|
||||||
NXCON_CSRCS += nxcon_redraw.c nxcon_register.c nxcon_scroll.c
|
NXTERM_CSRCS += nxterm_redraw.c nxterm_register.c nxterm_scroll.c
|
||||||
NXCON_CSRCS += nxcon_vt100.c nxcon_unregister.c nxtk_register.c
|
NXTERM_CSRCS += nxterm_vt100.c nxterm_unregister.c nxtk_register.c
|
||||||
NXCON_CSRCS += nxtool_register.c
|
NXTERM_CSRCS += nxtool_register.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NXTERM_NXKBDIN),y)
|
ifeq ($(CONFIG_NXTERM_NXKBDIN),y)
|
||||||
NXCON_CSRCS += nxcon_kbdin.c
|
NXTERM_CSRCS += nxterm_kbdin.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG),y)
|
ifeq ($(CONFIG_DEBUG),y)
|
||||||
NXCON_CSRCS += nxcon_sem.c
|
NXTERM_CSRCS += nxterm_sem.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
#include <nuttx/nx/nxterm.h>
|
#include <nuttx/nx/nxterm.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -52,15 +52,15 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_fill(FAR struct nxcon_state_s *priv,
|
static int nxterm_fill(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
static int nxcon_move(FAR struct nxcon_state_s *priv,
|
static int nxterm_move(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset);
|
FAR const struct nxgl_point_s *offset);
|
||||||
#endif
|
#endif
|
||||||
static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
|
static int nxterm_bitmap(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -70,13 +70,13 @@ static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static const struct nxcon_operations_s g_nxops =
|
static const struct nxterm_operations_s g_nxops =
|
||||||
{
|
{
|
||||||
nxcon_fill,
|
nxterm_fill,
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
nxcon_move,
|
nxterm_move,
|
||||||
#endif
|
#endif
|
||||||
nxcon_bitmap
|
nxterm_bitmap
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -84,7 +84,7 @@ static const struct nxcon_operations_s g_nxops =
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_fill
|
* Name: nxterm_fill
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Fill the specified rectangle in the window with the specified color
|
* Fill the specified rectangle in the window with the specified color
|
||||||
@@ -99,7 +99,7 @@ static const struct nxcon_operations_s g_nxops =
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_fill(FAR struct nxcon_state_s *priv,
|
static int nxterm_fill(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,7 @@ static int nxcon_fill(FAR struct nxcon_state_s *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_move
|
* Name: nxterm_move
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Move a rectangular region within the window
|
* Move a rectangular region within the window
|
||||||
@@ -124,7 +124,7 @@ static int nxcon_fill(FAR struct nxcon_state_s *priv,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
static int nxcon_move(FAR struct nxcon_state_s *priv,
|
static int nxterm_move(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset)
|
FAR const struct nxgl_point_s *offset)
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ static int nxcon_move(FAR struct nxcon_state_s *priv,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_bitmap
|
* Name: nxterm_bitmap
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy a rectangular region of a larger image into the rectangle in the
|
* Copy a rectangular region of a larger image into the rectangle in the
|
||||||
@@ -155,7 +155,7 @@ static int nxcon_move(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
|
static int nxterm_bitmap(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -173,7 +173,7 @@ static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register a console device on a raw NX window. The device will be
|
* Register a console device on a raw NX window. The device will be
|
||||||
* registered at /dev/nxconN where N is the provided minor number.
|
* registered at /dev/nxtermN where N is the provided minor number.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* hwnd - A handle that will be used to access the window. The window must
|
* hwnd - A handle that will be used to access the window. The window must
|
||||||
@@ -186,8 +186,8 @@ static int nxcon_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
NXTERM nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo, int minor)
|
NXTERM nx_register(NXWINDOW hwnd, FAR struct nxterm_window_s *wndo, int minor)
|
||||||
{
|
{
|
||||||
return nxcon_register((NXTERM)hwnd, wndo, &g_nxops, minor);
|
return nxterm_register((NXTERM)hwnd, wndo, &g_nxops, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_internal.h
|
* nuttx/graphics/nxterm/nxterm.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __GRAPHICS_NXTERM_NXCON_INTERNAL_H
|
#ifndef __GRAPHICS_NXTERM_NXTERM_INTERNAL_H
|
||||||
#define __GRAPHICS_NXTERM_NXCON_INTERNAL_H
|
#define __GRAPHICS_NXTERM_NXTERM_INTERNAL_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
/* Device path formats */
|
/* Device path formats */
|
||||||
|
|
||||||
#define NX_DEVNAME_FORMAT "/dev/nxcon%d"
|
#define NX_DEVNAME_FORMAT "/dev/nxterm%d"
|
||||||
#define NX_DEVNAME_SIZE 16
|
#define NX_DEVNAME_SIZE 16
|
||||||
|
|
||||||
/* Semaphore protection */
|
/* Semaphore protection */
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Identifies the state of the VT100 escape sequence processing */
|
/* Identifies the state of the VT100 escape sequence processing */
|
||||||
|
|
||||||
enum nxcon_vt100state_e
|
enum nxterm_vt100state_e
|
||||||
{
|
{
|
||||||
VT100_NOT_CONSUMED = 0, /* Character is not part of a VT100 escape sequence */
|
VT100_NOT_CONSUMED = 0, /* Character is not part of a VT100 escape sequence */
|
||||||
VT100_CONSUMED, /* Character was consumed as part of the VT100 escape processing */
|
VT100_CONSUMED, /* Character was consumed as part of the VT100 escape processing */
|
||||||
@@ -93,18 +93,18 @@ enum nxcon_vt100state_e
|
|||||||
|
|
||||||
/* Describes on set of console window callbacks */
|
/* Describes on set of console window callbacks */
|
||||||
|
|
||||||
struct nxcon_state_s;
|
struct nxterm_state_s;
|
||||||
struct nxcon_operations_s
|
struct nxterm_operations_s
|
||||||
{
|
{
|
||||||
int (*fill)(FAR struct nxcon_state_s *priv,
|
int (*fill)(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
int (*move)(FAR struct nxcon_state_s *priv,
|
int (*move)(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset);
|
FAR const struct nxgl_point_s *offset);
|
||||||
#endif
|
#endif
|
||||||
int (*bitmap)(FAR struct nxcon_state_s *priv,
|
int (*bitmap)(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -113,7 +113,7 @@ struct nxcon_operations_s
|
|||||||
|
|
||||||
/* Describes one cached glyph bitmap */
|
/* Describes one cached glyph bitmap */
|
||||||
|
|
||||||
struct nxcon_glyph_s
|
struct nxterm_glyph_s
|
||||||
{
|
{
|
||||||
uint8_t code; /* Character code */
|
uint8_t code; /* Character code */
|
||||||
uint8_t height; /* Height of this glyph (in rows) */
|
uint8_t height; /* Height of this glyph (in rows) */
|
||||||
@@ -125,7 +125,7 @@ struct nxcon_glyph_s
|
|||||||
|
|
||||||
/* Describes on character on the display */
|
/* Describes on character on the display */
|
||||||
|
|
||||||
struct nxcon_bitmap_s
|
struct nxterm_bitmap_s
|
||||||
{
|
{
|
||||||
uint8_t code; /* Character code */
|
uint8_t code; /* Character code */
|
||||||
uint8_t flags; /* See BMFLAGS_* */
|
uint8_t flags; /* See BMFLAGS_* */
|
||||||
@@ -134,11 +134,11 @@ struct nxcon_bitmap_s
|
|||||||
|
|
||||||
/* Describes the state of one NX console driver*/
|
/* Describes the state of one NX console driver*/
|
||||||
|
|
||||||
struct nxcon_state_s
|
struct nxterm_state_s
|
||||||
{
|
{
|
||||||
FAR const struct nxcon_operations_s *ops; /* Window operations */
|
FAR const struct nxterm_operations_s *ops; /* Window operations */
|
||||||
FAR void *handle; /* The window handle */
|
FAR void *handle; /* The window handle */
|
||||||
FAR struct nxcon_window_s wndo; /* Describes the window and font */
|
FAR struct nxterm_window_s wndo; /* Describes the window and font */
|
||||||
NXHANDLE font; /* The current font handle */
|
NXHANDLE font; /* The current font handle */
|
||||||
sem_t exclsem; /* Forces mutually exclusive access */
|
sem_t exclsem; /* Forces mutually exclusive access */
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
@@ -165,12 +165,12 @@ struct nxcon_state_s
|
|||||||
|
|
||||||
/* Font cache data storage */
|
/* Font cache data storage */
|
||||||
|
|
||||||
struct nxcon_bitmap_s cursor;
|
struct nxterm_bitmap_s cursor;
|
||||||
struct nxcon_bitmap_s bm[CONFIG_NXTERM_MXCHARS];
|
struct nxterm_bitmap_s bm[CONFIG_NXTERM_MXCHARS];
|
||||||
|
|
||||||
/* Glyph cache data storage */
|
/* Glyph cache data storage */
|
||||||
|
|
||||||
struct nxcon_glyph_s glyph[CONFIG_NXTERM_CACHESIZE];
|
struct nxterm_glyph_s glyph[CONFIG_NXTERM_CACHESIZE];
|
||||||
|
|
||||||
/* Keyboard input support */
|
/* Keyboard input support */
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ struct nxcon_state_s
|
|||||||
|
|
||||||
/* This is the common NX driver file operations */
|
/* This is the common NX driver file operations */
|
||||||
|
|
||||||
extern const struct file_operations g_nxcon_drvrops;
|
extern const struct file_operations g_nxterm_drvrops;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
@@ -207,48 +207,48 @@ extern const struct file_operations g_nxcon_drvrops;
|
|||||||
/* Semaphore helpers */
|
/* Semaphore helpers */
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
int nxcon_semwait(FAR struct nxcon_state_s *priv);
|
int nxterm_semwait(FAR struct nxterm_state_s *priv);
|
||||||
int nxcon_sempost(FAR struct nxcon_state_s *priv);
|
int nxterm_sempost(FAR struct nxterm_state_s *priv);
|
||||||
#else
|
#else
|
||||||
# define nxcon_semwait(p) sem_wait(&p->exclsem)
|
# define nxterm_semwait(p) sem_wait(&p->exclsem)
|
||||||
# define nxcon_sempost(p) sem_post(&p->exclsem)
|
# define nxterm_sempost(p) sem_post(&p->exclsem)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Common device registration */
|
/* Common device registration */
|
||||||
|
|
||||||
FAR struct nxcon_state_s *nxcon_register(NXTERM handle,
|
FAR struct nxterm_state_s *nxterm_register(NXTERM handle,
|
||||||
FAR struct nxcon_window_s *wndo, FAR const struct nxcon_operations_s *ops,
|
FAR struct nxterm_window_s *wndo, FAR const struct nxterm_operations_s *ops,
|
||||||
int minor);
|
int minor);
|
||||||
|
|
||||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||||
ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len);
|
ssize_t nxterm_read(FAR struct file *filep, FAR char *buffer, size_t len);
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup);
|
int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* VT100 Terminal emulation */
|
/* VT100 Terminal emulation */
|
||||||
|
|
||||||
enum nxcon_vt100state_e nxcon_vt100(FAR struct nxcon_state_s *priv, char ch);
|
enum nxterm_vt100state_e nxterm_vt100(FAR struct nxterm_state_s *priv, char ch);
|
||||||
|
|
||||||
/* Generic text display helpers */
|
/* Generic text display helpers */
|
||||||
|
|
||||||
void nxcon_home(FAR struct nxcon_state_s *priv);
|
void nxterm_home(FAR struct nxterm_state_s *priv);
|
||||||
void nxcon_newline(FAR struct nxcon_state_s *priv);
|
void nxterm_newline(FAR struct nxterm_state_s *priv);
|
||||||
FAR const struct nxcon_bitmap_s *nxcon_addchar(NXHANDLE hfont,
|
FAR const struct nxterm_bitmap_s *nxterm_addchar(NXHANDLE hfont,
|
||||||
FAR struct nxcon_state_s *priv, uint8_t ch);
|
FAR struct nxterm_state_s *priv, uint8_t ch);
|
||||||
int nxcon_hidechar(FAR struct nxcon_state_s *priv,
|
int nxterm_hidechar(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxcon_bitmap_s *bm);
|
FAR const struct nxterm_bitmap_s *bm);
|
||||||
int nxcon_backspace(FAR struct nxcon_state_s *priv);
|
int nxterm_backspace(FAR struct nxterm_state_s *priv);
|
||||||
void nxcon_fillchar(FAR struct nxcon_state_s *priv,
|
void nxterm_fillchar(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect, FAR const struct nxcon_bitmap_s *bm);
|
FAR const struct nxgl_rect_s *rect, FAR const struct nxterm_bitmap_s *bm);
|
||||||
|
|
||||||
void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch);
|
void nxterm_putc(FAR struct nxterm_state_s *priv, uint8_t ch);
|
||||||
void nxcon_showcursor(FAR struct nxcon_state_s *priv);
|
void nxterm_showcursor(FAR struct nxterm_state_s *priv);
|
||||||
void nxcon_hidecursor(FAR struct nxcon_state_s *priv);
|
void nxterm_hidecursor(FAR struct nxterm_state_s *priv);
|
||||||
|
|
||||||
/* Scrolling support */
|
/* Scrolling support */
|
||||||
|
|
||||||
void nxcon_scroll(FAR struct nxcon_state_s *priv, int scrollheight);
|
void nxterm_scroll(FAR struct nxterm_state_s *priv, int scrollheight);
|
||||||
|
|
||||||
#endif /* __GRAPHICS_NXTERM_NXCON_INTERNAL_H */
|
#endif /* __GRAPHICS_NXTERM_NXTERM_INTERNAL_H */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_driver.c
|
* nuttx/graphics/nxterm/nxterm_driver.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
|
|
||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_open(FAR struct file *filep);
|
static int nxterm_open(FAR struct file *filep);
|
||||||
static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
static ssize_t nxterm_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
size_t buflen);
|
size_t buflen);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -66,28 +66,28 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||||
|
|
||||||
const struct file_operations g_nxcon_drvrops =
|
const struct file_operations g_nxterm_drvrops =
|
||||||
{
|
{
|
||||||
nxcon_open, /* open */
|
nxterm_open, /* open */
|
||||||
0, /* close */
|
0, /* close */
|
||||||
nxcon_read, /* read */
|
nxterm_read, /* read */
|
||||||
nxcon_write, /* write */
|
nxterm_write, /* write */
|
||||||
0, /* seek */
|
0, /* seek */
|
||||||
0 /* ioctl */
|
0 /* ioctl */
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
,
|
,
|
||||||
nxcon_poll /* poll */
|
nxterm_poll /* poll */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* CONFIG_NXTERM_NXKBDIN */
|
#else /* CONFIG_NXTERM_NXKBDIN */
|
||||||
|
|
||||||
const struct file_operations g_nxcon_drvrops =
|
const struct file_operations g_nxterm_drvrops =
|
||||||
{
|
{
|
||||||
nxcon_open, /* open */
|
nxterm_open, /* open */
|
||||||
0, /* close */
|
0, /* close */
|
||||||
0, /* read */
|
0, /* read */
|
||||||
nxcon_write, /* write */
|
nxterm_write, /* write */
|
||||||
0, /* seek */
|
0, /* seek */
|
||||||
0 /* ioctl */
|
0 /* ioctl */
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
@@ -107,20 +107,20 @@ const struct file_operations g_nxcon_drvrops =
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_open
|
* Name: nxterm_open
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_open(FAR struct file *filep)
|
static int nxterm_open(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct nxcon_state_s *priv = inode->i_private;
|
FAR struct nxterm_state_s *priv = inode->i_private;
|
||||||
|
|
||||||
DEBUGASSERT(filep && filep->f_inode);
|
DEBUGASSERT(filep && filep->f_inode);
|
||||||
|
|
||||||
/* Get the driver structure from the inode */
|
/* Get the driver structure from the inode */
|
||||||
|
|
||||||
inode = filep->f_inode;
|
inode = filep->f_inode;
|
||||||
priv = (FAR struct nxcon_state_s *)inode->i_private;
|
priv = (FAR struct nxterm_state_s *)inode->i_private;
|
||||||
DEBUGASSERT(priv);
|
DEBUGASSERT(priv);
|
||||||
|
|
||||||
/* Verify that the driver is opened for write-only access */
|
/* Verify that the driver is opened for write-only access */
|
||||||
@@ -140,14 +140,14 @@ static int nxcon_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_write
|
* Name: nxterm_write
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
static ssize_t nxterm_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
size_t buflen)
|
size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
enum nxcon_vt100state_e state;
|
enum nxterm_vt100state_e state;
|
||||||
ssize_t remaining;
|
ssize_t remaining;
|
||||||
char ch;
|
char ch;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -155,11 +155,11 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
/* Recover our private state structure */
|
/* Recover our private state structure */
|
||||||
|
|
||||||
DEBUGASSERT(filep && filep->f_priv);
|
DEBUGASSERT(filep && filep->f_priv);
|
||||||
priv = (FAR struct nxcon_state_s *)filep->f_priv;
|
priv = (FAR struct nxterm_state_s *)filep->f_priv;
|
||||||
|
|
||||||
/* Get exclusive access */
|
/* Get exclusive access */
|
||||||
|
|
||||||
ret = nxcon_semwait(priv);
|
ret = nxterm_semwait(priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
@@ -167,7 +167,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
/* Hide the cursor while we update the display */
|
/* Hide the cursor while we update the display */
|
||||||
|
|
||||||
nxcon_hidecursor(priv);
|
nxterm_hidecursor(priv);
|
||||||
|
|
||||||
/* Loop writing each character to the display */
|
/* Loop writing each character to the display */
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
{
|
{
|
||||||
/* Is the character part of a VT100 escape sequnce? */
|
/* Is the character part of a VT100 escape sequnce? */
|
||||||
|
|
||||||
state = nxcon_vt100(priv, ch);
|
state = nxterm_vt100(priv, ch);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
/* Character is not part of a VT100 escape sequence (and no
|
/* Character is not part of a VT100 escape sequence (and no
|
||||||
@@ -195,7 +195,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
{
|
{
|
||||||
/* We can output the character to the window */
|
/* We can output the character to the window */
|
||||||
|
|
||||||
nxcon_putc(priv, (uint8_t)ch);
|
nxterm_putc(priv, (uint8_t)ch);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
/* Add the first unhandled character to the window */
|
/* Add the first unhandled character to the window */
|
||||||
|
|
||||||
nxcon_putc(priv, (uint8_t)priv->seq[0]);
|
nxterm_putc(priv, (uint8_t)priv->seq[0]);
|
||||||
|
|
||||||
/* Move all buffer characters down one */
|
/* Move all buffer characters down one */
|
||||||
|
|
||||||
@@ -246,8 +246,8 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
/* Show the cursor at its new position */
|
/* Show the cursor at its new position */
|
||||||
|
|
||||||
nxcon_showcursor(priv);
|
nxterm_showcursor(priv);
|
||||||
nxcon_sempost(priv);
|
nxterm_sempost(priv);
|
||||||
return (ssize_t)buflen;
|
return (ssize_t)buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_font.c
|
* nuttx/graphics/nxterm/nxterm_font.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
@@ -95,27 +95,27 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_freeglyph
|
* Name: nxterm_freeglyph
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void nxcon_freeglyph(FAR struct nxcon_glyph_s *glyph)
|
static void nxterm_freeglyph(FAR struct nxterm_glyph_s *glyph)
|
||||||
{
|
{
|
||||||
if (glyph->bitmap)
|
if (glyph->bitmap)
|
||||||
{
|
{
|
||||||
kmm_free(glyph->bitmap);
|
kmm_free(glyph->bitmap);
|
||||||
}
|
}
|
||||||
memset(glyph, 0, sizeof(struct nxcon_glyph_s));
|
memset(glyph, 0, sizeof(struct nxterm_glyph_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_allocglyph
|
* Name: nxterm_allocglyph
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline FAR struct nxcon_glyph_s *
|
static inline FAR struct nxterm_glyph_s *
|
||||||
nxcon_allocglyph(FAR struct nxcon_state_s *priv)
|
nxterm_allocglyph(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_glyph_s *glyph = NULL;
|
FAR struct nxterm_glyph_s *glyph = NULL;
|
||||||
FAR struct nxcon_glyph_s *luglyph = NULL;
|
FAR struct nxterm_glyph_s *luglyph = NULL;
|
||||||
uint8_t luusecnt;
|
uint8_t luusecnt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ nxcon_allocglyph(FAR struct nxcon_state_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
luusecnt = luglyph->usecnt;
|
luusecnt = luglyph->usecnt;
|
||||||
nxcon_freeglyph(luglyph);
|
nxterm_freeglyph(luglyph);
|
||||||
|
|
||||||
/* But lets decrement all of the usecnts so that the new one one be so
|
/* But lets decrement all of the usecnts so that the new one one be so
|
||||||
* far behind in the counts as the older ones.
|
* far behind in the counts as the older ones.
|
||||||
@@ -179,11 +179,11 @@ nxcon_allocglyph(FAR struct nxcon_state_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_findglyph
|
* Name: nxterm_findglyph
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static FAR struct nxcon_glyph_s *
|
static FAR struct nxterm_glyph_s *
|
||||||
nxcon_findglyph(FAR struct nxcon_state_s *priv, uint8_t ch)
|
nxterm_findglyph(FAR struct nxterm_state_s *priv, uint8_t ch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ nxcon_findglyph(FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
|
|
||||||
for (i = 0; i < priv->maxglyphs; i++)
|
for (i = 0; i < priv->maxglyphs; i++)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_glyph_s *glyph = &priv->glyph[i];
|
FAR struct nxterm_glyph_s *glyph = &priv->glyph[i];
|
||||||
if (glyph->usecnt > 0 && glyph->code == ch)
|
if (glyph->usecnt > 0 && glyph->code == ch)
|
||||||
{
|
{
|
||||||
/* Increment the use count (unless it is already at the max) */
|
/* Increment the use count (unless it is already at the max) */
|
||||||
@@ -210,14 +210,14 @@ nxcon_findglyph(FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_renderglyph
|
* Name: nxterm_renderglyph
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline FAR struct nxcon_glyph_s *
|
static inline FAR struct nxterm_glyph_s *
|
||||||
nxcon_renderglyph(FAR struct nxcon_state_s *priv,
|
nxterm_renderglyph(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nx_fontbitmap_s *fbm, uint8_t ch)
|
FAR const struct nx_fontbitmap_s *fbm, uint8_t ch)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_glyph_s *glyph = NULL;
|
FAR struct nxterm_glyph_s *glyph = NULL;
|
||||||
FAR nxgl_mxpixel_t *ptr;
|
FAR nxgl_mxpixel_t *ptr;
|
||||||
#if CONFIG_NXTERM_BPP < 8
|
#if CONFIG_NXTERM_BPP < 8
|
||||||
nxgl_mxpixel_t pixel;
|
nxgl_mxpixel_t pixel;
|
||||||
@@ -229,7 +229,7 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
|
|||||||
|
|
||||||
/* Allocate the glyph (always succeeds) */
|
/* Allocate the glyph (always succeeds) */
|
||||||
|
|
||||||
glyph = nxcon_allocglyph(priv);
|
glyph = nxterm_allocglyph(priv);
|
||||||
glyph->code = ch;
|
glyph->code = ch;
|
||||||
|
|
||||||
/* Get the dimensions of the glyph */
|
/* Get the dimensions of the glyph */
|
||||||
@@ -318,8 +318,8 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
|
|||||||
{
|
{
|
||||||
/* Actually, the RENDERER never returns a failure */
|
/* Actually, the RENDERER never returns a failure */
|
||||||
|
|
||||||
gdbg("nxcon_renderglyph: RENDERER failed\n");
|
gdbg("nxterm_renderglyph: RENDERER failed\n");
|
||||||
nxcon_freeglyph(glyph);
|
nxterm_freeglyph(glyph);
|
||||||
glyph = NULL;
|
glyph = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,10 +328,10 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_fontsize
|
* Name: nxterm_fontsize
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_fontsize(NXHANDLE hfont, uint8_t ch, FAR struct nxgl_size_s *size)
|
static int nxterm_fontsize(NXHANDLE hfont, uint8_t ch, FAR struct nxgl_size_s *size)
|
||||||
{
|
{
|
||||||
FAR const struct nx_fontbitmap_s *fbm;
|
FAR const struct nx_fontbitmap_s *fbm;
|
||||||
|
|
||||||
@@ -351,18 +351,18 @@ static int nxcon_fontsize(NXHANDLE hfont, uint8_t ch, FAR struct nxgl_size_s *si
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_getglyph
|
* Name: nxterm_getglyph
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static FAR struct nxcon_glyph_s *
|
static FAR struct nxterm_glyph_s *
|
||||||
nxcon_getglyph(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
|
nxterm_getglyph(NXHANDLE hfont, FAR struct nxterm_state_s *priv, uint8_t ch)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_glyph_s *glyph;
|
FAR struct nxterm_glyph_s *glyph;
|
||||||
FAR const struct nx_fontbitmap_s *fbm;
|
FAR const struct nx_fontbitmap_s *fbm;
|
||||||
|
|
||||||
/* First, try to find the glyph in the cache of pre-rendered glyphs */
|
/* First, try to find the glyph in the cache of pre-rendered glyphs */
|
||||||
|
|
||||||
glyph = nxcon_findglyph(priv, ch);
|
glyph = nxterm_findglyph(priv, ch);
|
||||||
if (glyph)
|
if (glyph)
|
||||||
{
|
{
|
||||||
/* We found it in the cache .. return the cached glyph */
|
/* We found it in the cache .. return the cached glyph */
|
||||||
@@ -377,7 +377,7 @@ nxcon_getglyph(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
{
|
{
|
||||||
/* Yes.. render the glyph */
|
/* Yes.. render the glyph */
|
||||||
|
|
||||||
glyph = nxcon_renderglyph(priv, fbm, ch);
|
glyph = nxterm_renderglyph(priv, fbm, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
return glyph;
|
return glyph;
|
||||||
@@ -388,19 +388,19 @@ nxcon_getglyph(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_addchar
|
* Name: nxterm_addchar
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is part of the nxcon_putc logic. It creates and positions a
|
* This is part of the nxterm_putc logic. It creates and positions a
|
||||||
* the character and renders (or re-uses) a glyph for font.
|
* the character and renders (or re-uses) a glyph for font.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR const struct nxcon_bitmap_s *
|
FAR const struct nxterm_bitmap_s *
|
||||||
nxcon_addchar(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
|
nxterm_addchar(NXHANDLE hfont, FAR struct nxterm_state_s *priv, uint8_t ch)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_bitmap_s *bm = NULL;
|
FAR struct nxterm_bitmap_s *bm = NULL;
|
||||||
FAR struct nxcon_glyph_s *glyph;
|
FAR struct nxterm_glyph_s *glyph;
|
||||||
|
|
||||||
/* Is there space for another character on the display? */
|
/* Is there space for another character on the display? */
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ nxcon_addchar(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
|
|
||||||
/* Find (or create) the matching glyph */
|
/* Find (or create) the matching glyph */
|
||||||
|
|
||||||
glyph = nxcon_getglyph(hfont, priv, ch);
|
glyph = nxterm_getglyph(hfont, priv, ch);
|
||||||
if (!glyph)
|
if (!glyph)
|
||||||
{
|
{
|
||||||
/* No, there is no font for this code. Just mark this as a space. */
|
/* No, there is no font for this code. Just mark this as a space. */
|
||||||
@@ -443,25 +443,25 @@ nxcon_addchar(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_hidechar
|
* Name: nxterm_hidechar
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Erase a character from the window.
|
* Erase a character from the window.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int nxcon_hidechar(FAR struct nxcon_state_s *priv,
|
int nxterm_hidechar(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxcon_bitmap_s *bm)
|
FAR const struct nxterm_bitmap_s *bm)
|
||||||
{
|
{
|
||||||
struct nxgl_rect_s bounds;
|
struct nxgl_rect_s bounds;
|
||||||
struct nxgl_size_s fsize;
|
struct nxgl_size_s fsize;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get the size of the font glyph. If nxcon_fontsize, then the
|
/* Get the size of the font glyph. If nxterm_fontsize, then the
|
||||||
* character will have been rendered as a space, and no display
|
* character will have been rendered as a space, and no display
|
||||||
* modification is required (not an error).
|
* modification is required (not an error).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = nxcon_fontsize(priv->font, bm->code, &fsize);
|
ret = nxterm_fontsize(priv->font, bm->code, &fsize);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
/* It was rendered as a space. */
|
/* It was rendered as a space. */
|
||||||
@@ -485,16 +485,16 @@ int nxcon_hidechar(FAR struct nxcon_state_s *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_backspace
|
* Name: nxterm_backspace
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Remove the last character from the window.
|
* Remove the last character from the window.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int nxcon_backspace(FAR struct nxcon_state_s *priv)
|
int nxterm_backspace(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_bitmap_s *bm;
|
FAR struct nxterm_bitmap_s *bm;
|
||||||
int ndx;
|
int ndx;
|
||||||
int ret = -ENOENT;
|
int ret = -ENOENT;
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ int nxcon_backspace(FAR struct nxcon_state_s *priv)
|
|||||||
|
|
||||||
/* Erase the character from the display */
|
/* Erase the character from the display */
|
||||||
|
|
||||||
ret = nxcon_hidechar(priv, bm);
|
ret = nxterm_hidechar(priv, bm);
|
||||||
|
|
||||||
/* The current position to the location where the last character was */
|
/* The current position to the location where the last character was */
|
||||||
|
|
||||||
@@ -525,14 +525,14 @@ int nxcon_backspace(FAR struct nxcon_state_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_home
|
* Name: nxterm_home
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the next character position to the top-left corner of the display.
|
* Set the next character position to the top-left corner of the display.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_home(FAR struct nxcon_state_s *priv)
|
void nxterm_home(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
/* The first character is one space from the left */
|
/* The first character is one space from the left */
|
||||||
|
|
||||||
@@ -544,14 +544,14 @@ void nxcon_home(FAR struct nxcon_state_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_newline
|
* Name: nxterm_newline
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the next character position to the beginning of the next line.
|
* Set the next character position to the beginning of the next line.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_newline(FAR struct nxcon_state_s *priv)
|
void nxterm_newline(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
/* Carriage return: The first character is one space from the left */
|
/* Carriage return: The first character is one space from the left */
|
||||||
|
|
||||||
@@ -563,19 +563,19 @@ void nxcon_newline(FAR struct nxcon_state_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_fillchar
|
* Name: nxterm_fillchar
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This implements the character display. It is part of the nxcon_putc
|
* This implements the character display. It is part of the nxterm_putc
|
||||||
* operation but may also be used when redrawing an existing display.
|
* operation but may also be used when redrawing an existing display.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_fillchar(FAR struct nxcon_state_s *priv,
|
void nxterm_fillchar(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxcon_bitmap_s *bm)
|
FAR const struct nxterm_bitmap_s *bm)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_glyph_s *glyph;
|
FAR struct nxterm_glyph_s *glyph;
|
||||||
struct nxgl_rect_s bounds;
|
struct nxgl_rect_s bounds;
|
||||||
struct nxgl_rect_s intersection;
|
struct nxgl_rect_s intersection;
|
||||||
struct nxgl_size_s fsize;
|
struct nxgl_size_s fsize;
|
||||||
@@ -590,7 +590,7 @@ void nxcon_fillchar(FAR struct nxcon_state_s *priv,
|
|||||||
|
|
||||||
/* Get the size of the font glyph (which may not have been created yet) */
|
/* Get the size of the font glyph (which may not have been created yet) */
|
||||||
|
|
||||||
ret = nxcon_fontsize(priv->font, bm->code, &fsize);
|
ret = nxterm_fontsize(priv->font, bm->code, &fsize);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
/* This would mean that there is no bitmap for the character code and
|
/* This would mean that there is no bitmap for the character code and
|
||||||
@@ -632,7 +632,7 @@ void nxcon_fillchar(FAR struct nxcon_state_s *priv,
|
|||||||
|
|
||||||
/* Find (or create) the glyph that goes with this font */
|
/* Find (or create) the glyph that goes with this font */
|
||||||
|
|
||||||
glyph = nxcon_getglyph(priv->font, priv, bm->code);
|
glyph = nxterm_getglyph(priv->font, priv, bm->code);
|
||||||
if (!glyph)
|
if (!glyph)
|
||||||
{
|
{
|
||||||
/* Shouldn't happen */
|
/* Shouldn't happen */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_kbdin.c
|
* nuttx/graphics/nxterm/nxterm_kbdin.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||||
|
|
||||||
@@ -67,11 +67,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_pollnotify
|
* Name: nxterm_pollnotify
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
static void nxcon_pollnotify(FAR struct nxcon_state_s *priv, pollevent_t eventset)
|
static void nxterm_pollnotify(FAR struct nxterm_state_s *priv, pollevent_t eventset)
|
||||||
{
|
{
|
||||||
FAR struct pollfd *fds;
|
FAR struct pollfd *fds;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
@@ -95,7 +95,7 @@ static void nxcon_pollnotify(FAR struct nxcon_state_s *priv, pollevent_t eventse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define nxcon_pollnotify(priv,event)
|
# define nxterm_pollnotify(priv,event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -103,16 +103,16 @@ static void nxcon_pollnotify(FAR struct nxcon_state_s *priv, pollevent_t eventse
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_read
|
* Name: nxterm_read
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The optional NxTerm read method
|
* The optional NxTerm read method
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
ssize_t nxterm_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
char ch;
|
char ch;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -120,14 +120,14 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
/* Recover our private state structure */
|
/* Recover our private state structure */
|
||||||
|
|
||||||
DEBUGASSERT(filep && filep->f_priv);
|
DEBUGASSERT(filep && filep->f_priv);
|
||||||
priv = (FAR struct nxcon_state_s *)filep->f_priv;
|
priv = (FAR struct nxterm_state_s *)filep->f_priv;
|
||||||
|
|
||||||
/* Get exclusive access to the driver structure */
|
/* Get exclusive access to the driver structure */
|
||||||
|
|
||||||
ret = nxcon_semwait(priv);
|
ret = nxterm_semwait(priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
gdbg("ERROR: nxcon_semwait failed\n");
|
gdbg("ERROR: nxterm_semwait failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,13 +159,13 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, wait for something to be written to the circular
|
/* Otherwise, wait for something to be written to the circular
|
||||||
* buffer. Increment the number of waiters so that the nxcon_write()
|
* buffer. Increment the number of waiters so that the nxterm_write()
|
||||||
* will not that it needs to post the semaphore to wake us up.
|
* will not that it needs to post the semaphore to wake us up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
priv->nwaiters++;
|
priv->nwaiters++;
|
||||||
nxcon_sempost(priv);
|
nxterm_sempost(priv);
|
||||||
|
|
||||||
/* We may now be pre-empted! But that should be okay because we
|
/* We may now be pre-empted! But that should be okay because we
|
||||||
* have already incremented nwaiters. Pre-emption is disabled
|
* have already incremented nwaiters. Pre-emption is disabled
|
||||||
@@ -187,7 +187,7 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
{
|
{
|
||||||
/* Yes... then retake the mutual exclusion semaphore */
|
/* Yes... then retake the mutual exclusion semaphore */
|
||||||
|
|
||||||
ret = nxcon_semwait(priv);
|
ret = nxterm_semwait(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Was the semaphore wait successful? Did we successful re-take the
|
/* Was the semaphore wait successful? Did we successful re-take the
|
||||||
@@ -200,7 +200,7 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
|
|
||||||
int errval = errno;
|
int errval = errno;
|
||||||
|
|
||||||
gdbg("ERROR: nxcon_semwait failed\n");
|
gdbg("ERROR: nxterm_semwait failed\n");
|
||||||
|
|
||||||
/* Were we awakened by a signal? Did we read anything before
|
/* Were we awakened by a signal? Did we read anything before
|
||||||
* we received the signal?
|
* we received the signal?
|
||||||
@@ -245,7 +245,7 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
|
|
||||||
/* Relinquish the mutual exclusion semaphore */
|
/* Relinquish the mutual exclusion semaphore */
|
||||||
|
|
||||||
nxcon_sempost(priv);
|
nxterm_sempost(priv);
|
||||||
|
|
||||||
/* Notify all poll/select waiters that they can write to the FIFO */
|
/* Notify all poll/select waiters that they can write to the FIFO */
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ errout_without_sem:
|
|||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
if (nread > 0)
|
if (nread > 0)
|
||||||
{
|
{
|
||||||
nxcon_pollnotify(priv, POLLOUT);
|
nxterm_pollnotify(priv, POLLOUT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -264,14 +264,14 @@ errout_without_sem:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_poll
|
* Name: nxterm_poll
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
pollevent_t eventset;
|
pollevent_t eventset;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
@@ -283,10 +283,10 @@ int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
|
|
||||||
/* Get exclusive access to the driver structure */
|
/* Get exclusive access to the driver structure */
|
||||||
|
|
||||||
ret = nxcon_semwait(priv);
|
ret = nxterm_semwait(priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
gdbg("ERROR: nxcon_semwait failed\n");
|
gdbg("ERROR: nxterm_semwait failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
|
|
||||||
if (eventset)
|
if (eventset)
|
||||||
{
|
{
|
||||||
nxcon_pollnotify(priv, eventset);
|
nxterm_pollnotify(priv, eventset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -363,13 +363,13 @@ int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
nxcon_sempost(priv);
|
nxterm_sempost(priv);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_kbdin
|
* Name: nxterm_kbdin
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function should be driven by the window kbdin callback function
|
* This function should be driven by the window kbdin callback function
|
||||||
@@ -394,9 +394,9 @@ errout:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen)
|
void nxterm_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
ssize_t nwritten;
|
ssize_t nwritten;
|
||||||
int nexthead;
|
int nexthead;
|
||||||
char ch;
|
char ch;
|
||||||
@@ -407,14 +407,14 @@ void nxcon_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen)
|
|||||||
|
|
||||||
/* Get the reference to the driver structure from the handle */
|
/* Get the reference to the driver structure from the handle */
|
||||||
|
|
||||||
priv = (FAR struct nxcon_state_s *)handle;
|
priv = (FAR struct nxterm_state_s *)handle;
|
||||||
|
|
||||||
/* Get exclusive access to the driver structure */
|
/* Get exclusive access to the driver structure */
|
||||||
|
|
||||||
ret = nxcon_semwait(priv);
|
ret = nxterm_semwait(priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
gdbg("ERROR: nxcon_semwait failed\n");
|
gdbg("ERROR: nxterm_semwait failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,12 +478,12 @@ void nxcon_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen)
|
|||||||
/* Notify all poll/select waiters that they can write to the FIFO */
|
/* Notify all poll/select waiters that they can write to the FIFO */
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
nxcon_pollnotify(priv, POLLIN);
|
nxterm_pollnotify(priv, POLLIN);
|
||||||
#endif
|
#endif
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
nxcon_sempost(priv);
|
nxterm_sempost(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NXTERM_NXKBDIN */
|
#endif /* CONFIG_NXTERM_NXKBDIN */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_putc.c
|
* nuttx/graphics/nxterm/nxterm_putc.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#include <nuttx/ascii.h>
|
#include <nuttx/ascii.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
@@ -68,16 +68,16 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_putc
|
* Name: nxterm_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Render the specified character at the current display position.
|
* Render the specified character at the current display position.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
|
void nxterm_putc(FAR struct nxterm_state_s *priv, uint8_t ch)
|
||||||
{
|
{
|
||||||
FAR const struct nxcon_bitmap_s *bm;
|
FAR const struct nxterm_bitmap_s *bm;
|
||||||
int lineheight;
|
int lineheight;
|
||||||
|
|
||||||
/* Ignore carriage returns */
|
/* Ignore carriage returns */
|
||||||
@@ -91,7 +91,7 @@ void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
|
|
||||||
if (ch == ASCII_BS || ch == ASCII_DEL)
|
if (ch == ASCII_BS || ch == ASCII_DEL)
|
||||||
{
|
{
|
||||||
nxcon_backspace(priv);
|
nxterm_backspace(priv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
#ifndef CONFIG_NXTERM_NOWRAP
|
#ifndef CONFIG_NXTERM_NOWRAP
|
||||||
/* No.. move to the next line */
|
/* No.. move to the next line */
|
||||||
|
|
||||||
nxcon_newline(priv);
|
nxterm_newline(priv);
|
||||||
|
|
||||||
/* If we were about to output a newline character, then don't */
|
/* If we were about to output a newline character, then don't */
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
|
|
||||||
if (ch == '\n')
|
if (ch == '\n')
|
||||||
{
|
{
|
||||||
nxcon_newline(priv);
|
nxterm_newline(priv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,29 +135,29 @@ void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
|
|||||||
lineheight = (priv->fheight + CONFIG_NXTERM_LINESEPARATION);
|
lineheight = (priv->fheight + CONFIG_NXTERM_LINESEPARATION);
|
||||||
while (priv->fpos.y >= priv->wndo.wsize.h - lineheight)
|
while (priv->fpos.y >= priv->wndo.wsize.h - lineheight)
|
||||||
{
|
{
|
||||||
nxcon_scroll(priv, lineheight);
|
nxterm_scroll(priv, lineheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the glyph associated with the character and render it onto the
|
/* Find the glyph associated with the character and render it onto the
|
||||||
* display.
|
* display.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bm = nxcon_addchar(priv->font, priv, ch);
|
bm = nxterm_addchar(priv->font, priv, ch);
|
||||||
if (bm)
|
if (bm)
|
||||||
{
|
{
|
||||||
nxcon_fillchar(priv, NULL, bm);
|
nxterm_fillchar(priv, NULL, bm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_showcursor
|
* Name: nxterm_showcursor
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Render the cursor character at the current display position.
|
* Render the cursor character at the current display position.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_showcursor(FAR struct nxcon_state_s *priv)
|
void nxterm_showcursor(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
int lineheight;
|
int lineheight;
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ void nxcon_showcursor(FAR struct nxcon_state_s *priv)
|
|||||||
#ifndef CONFIG_NXTERM_NOWRAP
|
#ifndef CONFIG_NXTERM_NOWRAP
|
||||||
/* No.. move to the next line */
|
/* No.. move to the next line */
|
||||||
|
|
||||||
nxcon_newline(priv);
|
nxterm_newline(priv);
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@@ -179,25 +179,25 @@ void nxcon_showcursor(FAR struct nxcon_state_s *priv)
|
|||||||
lineheight = (priv->fheight + CONFIG_NXTERM_LINESEPARATION);
|
lineheight = (priv->fheight + CONFIG_NXTERM_LINESEPARATION);
|
||||||
while (priv->fpos.y >= priv->wndo.wsize.h - lineheight)
|
while (priv->fpos.y >= priv->wndo.wsize.h - lineheight)
|
||||||
{
|
{
|
||||||
nxcon_scroll(priv, lineheight);
|
nxterm_scroll(priv, lineheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Render the cursor glyph onto the display. */
|
/* Render the cursor glyph onto the display. */
|
||||||
|
|
||||||
priv->cursor.pos.x = priv->fpos.x;
|
priv->cursor.pos.x = priv->fpos.x;
|
||||||
priv->cursor.pos.y = priv->fpos.y;
|
priv->cursor.pos.y = priv->fpos.y;
|
||||||
nxcon_fillchar(priv, NULL, &priv->cursor);
|
nxterm_fillchar(priv, NULL, &priv->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_hidecursor
|
* Name: nxterm_hidecursor
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Render the cursor cursor character from the display.
|
* Render the cursor cursor character from the display.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_hidecursor(FAR struct nxcon_state_s *priv)
|
void nxterm_hidecursor(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
(void)nxcon_hidechar(priv, &priv->cursor);
|
(void)nxterm_hidechar(priv, &priv->cursor);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_bkgd.c
|
* nuttx/graphics/nxterm/nxterm_bkgd.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
#include <nuttx/nx/nxglib.h>
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_redraw
|
* Name: nxterm_redraw
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Re-draw a portion of the NX console. This function should be called
|
* Re-draw a portion of the NX console. This function should be called
|
||||||
@@ -98,9 +98,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more)
|
void nxterm_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -111,13 +111,13 @@ void nxcon_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more)
|
|||||||
|
|
||||||
/* Recover our private state structure */
|
/* Recover our private state structure */
|
||||||
|
|
||||||
priv = (FAR struct nxcon_state_s *)handle;
|
priv = (FAR struct nxterm_state_s *)handle;
|
||||||
|
|
||||||
/* Get exclusive access to the state structure */
|
/* Get exclusive access to the state structure */
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = nxcon_semwait(priv);
|
ret = nxterm_semwait(priv);
|
||||||
|
|
||||||
/* Check for errors */
|
/* Check for errors */
|
||||||
|
|
||||||
@@ -146,8 +146,8 @@ void nxcon_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more)
|
|||||||
|
|
||||||
for (i = 0; i < priv->nchars; i++)
|
for (i = 0; i < priv->nchars; i++)
|
||||||
{
|
{
|
||||||
nxcon_fillchar(priv, rect, &priv->bm[i]);
|
nxterm_fillchar(priv, rect, &priv->bm[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)nxcon_sempost(priv);
|
(void)nxterm_sempost(priv);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_register.c
|
* nuttx/graphics/nxterm/nxterm_register.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
@@ -69,14 +69,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_allocate
|
* Name: nxterm_allocate
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct nxcon_state_s *
|
FAR struct nxterm_state_s *
|
||||||
nxcon_register(NXTERM handle, FAR struct nxcon_window_s *wndo,
|
nxterm_register(NXTERM handle, FAR struct nxterm_window_s *wndo,
|
||||||
FAR const struct nxcon_operations_s *ops, int minor)
|
FAR const struct nxterm_operations_s *ops, int minor)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
char devname[NX_DEVNAME_SIZE];
|
char devname[NX_DEVNAME_SIZE];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ FAR struct nxcon_state_s *
|
|||||||
|
|
||||||
/* Allocate the driver structure */
|
/* Allocate the driver structure */
|
||||||
|
|
||||||
priv = (FAR struct nxcon_state_s *)kmm_zalloc(sizeof(struct nxcon_state_s));
|
priv = (FAR struct nxterm_state_s *)kmm_zalloc(sizeof(struct nxterm_state_s));
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
gdbg("Failed to allocate the NX driver structure\n");
|
gdbg("Failed to allocate the NX driver structure\n");
|
||||||
@@ -96,7 +96,7 @@ FAR struct nxcon_state_s *
|
|||||||
priv->ops = ops;
|
priv->ops = ops;
|
||||||
priv->handle = handle;
|
priv->handle = handle;
|
||||||
priv->minor = minor;
|
priv->minor = minor;
|
||||||
memcpy(&priv->wndo, wndo, sizeof( struct nxcon_window_s));
|
memcpy(&priv->wndo, wndo, sizeof( struct nxterm_window_s));
|
||||||
|
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
@@ -137,17 +137,17 @@ FAR struct nxcon_state_s *
|
|||||||
|
|
||||||
/* Set the initial display position */
|
/* Set the initial display position */
|
||||||
|
|
||||||
nxcon_home(priv);
|
nxterm_home(priv);
|
||||||
|
|
||||||
/* Show the cursor */
|
/* Show the cursor */
|
||||||
|
|
||||||
priv->cursor.code = CONFIG_NXTERM_CURSORCHAR;
|
priv->cursor.code = CONFIG_NXTERM_CURSORCHAR;
|
||||||
nxcon_showcursor(priv);
|
nxterm_showcursor(priv);
|
||||||
|
|
||||||
/* Register the driver */
|
/* Register the driver */
|
||||||
|
|
||||||
snprintf(devname, NX_DEVNAME_SIZE, NX_DEVNAME_FORMAT, minor);
|
snprintf(devname, NX_DEVNAME_SIZE, NX_DEVNAME_FORMAT, minor);
|
||||||
ret = register_driver(devname, &g_nxcon_drvrops, 0666, priv);
|
ret = register_driver(devname, &g_nxterm_drvrops, 0666, priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
gdbg("Failed to register %s\n", devname);
|
gdbg("Failed to register %s\n", devname);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_scroll.c
|
* nuttx/graphics/nxterm/nxterm_scroll.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
#include <nuttx/nx/nxfonts.h>
|
#include <nuttx/nx/nxfonts.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_movedisplay
|
* Name: nxterm_movedisplay
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function implements the data movement for the scroll operation. If
|
* This function implements the data movement for the scroll operation. If
|
||||||
@@ -88,17 +88,17 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_WRITEONLY
|
#ifdef CONFIG_NX_WRITEONLY
|
||||||
static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
|
static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv,
|
||||||
int bottom, int scrollheight)
|
int bottom, int scrollheight)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_bitmap_s *bm;
|
FAR struct nxterm_bitmap_s *bm;
|
||||||
struct nxgl_rect_s rect;
|
struct nxgl_rect_s rect;
|
||||||
nxgl_coord_t row;
|
nxgl_coord_t row;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Move each row, one at a time. They could all be moved at once (by calling
|
/* Move each row, one at a time. They could all be moved at once (by calling
|
||||||
* nxcon_redraw), but the since the region is cleared, then re-written, the
|
* nxterm_redraw), but the since the region is cleared, then re-written, the
|
||||||
* effect would not be good. Below the region is also cleared and re-written,
|
* effect would not be good. Below the region is also cleared and re-written,
|
||||||
* however, in much smaller chunks.
|
* however, in much smaller chunks.
|
||||||
*/
|
*/
|
||||||
@@ -128,7 +128,7 @@ static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
|
|||||||
bm = &priv->bm[i];
|
bm = &priv->bm[i];
|
||||||
if (bm->pos.y <= rect.pt2.y && bm->pos.y + priv->fheight >= rect.pt1.y)
|
if (bm->pos.y <= rect.pt2.y && bm->pos.y + priv->fheight >= rect.pt1.y)
|
||||||
{
|
{
|
||||||
nxcon_fillchar(priv, &rect, bm);
|
nxterm_fillchar(priv, &rect, bm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
|
static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv,
|
||||||
int bottom, int scrollheight)
|
int bottom, int scrollheight)
|
||||||
{
|
{
|
||||||
struct nxgl_rect_s rect;
|
struct nxgl_rect_s rect;
|
||||||
@@ -197,10 +197,10 @@ static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_scroll
|
* Name: nxterm_scroll
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_scroll(FAR struct nxcon_state_s *priv, int scrollheight)
|
void nxterm_scroll(FAR struct nxterm_state_s *priv, int scrollheight)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
@@ -209,7 +209,7 @@ void nxcon_scroll(FAR struct nxcon_state_s *priv, int scrollheight)
|
|||||||
|
|
||||||
for (i = 0; i < priv->nchars; )
|
for (i = 0; i < priv->nchars; )
|
||||||
{
|
{
|
||||||
FAR struct nxcon_bitmap_s *bm = &priv->bm[i];
|
FAR struct nxterm_bitmap_s *bm = &priv->bm[i];
|
||||||
|
|
||||||
/* Has any part of this character scrolled off the screen? */
|
/* Has any part of this character scrolled off the screen? */
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ void nxcon_scroll(FAR struct nxcon_state_s *priv, int scrollheight)
|
|||||||
|
|
||||||
for (j = i; j < priv->nchars-1; j++)
|
for (j = i; j < priv->nchars-1; j++)
|
||||||
{
|
{
|
||||||
memcpy(&priv->bm[j], &priv->bm[j+1], sizeof(struct nxcon_bitmap_s));
|
memcpy(&priv->bm[j], &priv->bm[j+1], sizeof(struct nxterm_bitmap_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decrement the number of cached characters ('i' is not incremented
|
/* Decrement the number of cached characters ('i' is not incremented
|
||||||
@@ -249,5 +249,5 @@ void nxcon_scroll(FAR struct nxcon_state_s *priv, int scrollheight)
|
|||||||
|
|
||||||
/* Move the display in the range of 0-height up one scrollheight. */
|
/* Move the display in the range of 0-height up one scrollheight. */
|
||||||
|
|
||||||
nxcon_movedisplay(priv, priv->fpos.y, scrollheight);
|
nxterm_movedisplay(priv, priv->fpos.y, scrollheight);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_sem.c
|
* nuttx/graphics/nxterm/nxterm_sem.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_semwait and nxcon_sempost
|
* Name: nxterm_semwait and nxterm_sempost
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* If debug is on, then lower level code may attempt console output while
|
* If debug is on, then lower level code may attempt console output while
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int nxcon_semwait(FAR struct nxcon_state_s *priv)
|
int nxterm_semwait(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
pid_t me;
|
pid_t me;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -112,7 +112,7 @@ int nxcon_semwait(FAR struct nxcon_state_s *priv)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nxcon_sempost(FAR struct nxcon_state_s *priv)
|
int nxterm_sempost(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
pid_t me = getpid();
|
pid_t me = getpid();
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_unregister.c
|
* nuttx/graphics/nxterm/nxterm_unregister.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/nx/nxterm.h>
|
#include <nuttx/nx/nxterm.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_unregister
|
* Name: nxterm_unregister
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Un-register to NX console device.
|
* Un-register to NX console device.
|
||||||
@@ -85,9 +85,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxcon_unregister(NXTERM handle)
|
void nxterm_unregister(NXTERM handle)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_state_s *priv;
|
FAR struct nxterm_state_s *priv;
|
||||||
char devname[NX_DEVNAME_SIZE];
|
char devname[NX_DEVNAME_SIZE];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ void nxcon_unregister(NXTERM handle)
|
|||||||
|
|
||||||
/* Get the reference to the driver structure from the handle */
|
/* Get the reference to the driver structure from the handle */
|
||||||
|
|
||||||
priv = (FAR struct nxcon_state_s *)handle;
|
priv = (FAR struct nxterm_state_s *)handle;
|
||||||
sem_destroy(&priv->exclsem);
|
sem_destroy(&priv->exclsem);
|
||||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||||
sem_destroy(&priv->waitsem);
|
sem_destroy(&priv->waitsem);
|
||||||
@@ -105,7 +105,7 @@ void nxcon_unregister(NXTERM handle)
|
|||||||
|
|
||||||
for (i = 0; i < CONFIG_NXTERM_CACHESIZE; i++)
|
for (i = 0; i < CONFIG_NXTERM_CACHESIZE; i++)
|
||||||
{
|
{
|
||||||
FAR struct nxcon_glyph_s *glyph = &priv->glyph[i];
|
FAR struct nxterm_glyph_s *glyph = &priv->glyph[i];
|
||||||
if (glyph->bitmap)
|
if (glyph->bitmap)
|
||||||
{
|
{
|
||||||
kmm_free(glyph->bitmap);
|
kmm_free(glyph->bitmap);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxcon_vt100.c
|
* nuttx/graphics/nxterm/nxterm_vt100.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
#include <nuttx/vt100.h>
|
#include <nuttx/vt100.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
typedef int (*seqhandler_t)(FAR struct nxcon_state_s *priv);
|
typedef int (*seqhandler_t)(FAR struct nxterm_state_s *priv);
|
||||||
|
|
||||||
struct vt100_sequence_s
|
struct vt100_sequence_s
|
||||||
{
|
{
|
||||||
@@ -67,7 +67,7 @@ struct vt100_sequence_s
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_erasetoeol(FAR struct nxcon_state_s *priv);
|
static int nxterm_erasetoeol(FAR struct nxterm_state_s *priv);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@@ -85,7 +85,7 @@ static const char g_erasetoeol[] = VT100_CLEAREOL;
|
|||||||
|
|
||||||
static const struct vt100_sequence_s g_vt100sequences[] =
|
static const struct vt100_sequence_s g_vt100sequences[] =
|
||||||
{
|
{
|
||||||
{g_erasetoeol, nxcon_erasetoeol, sizeof(g_erasetoeol)},
|
{g_erasetoeol, nxterm_erasetoeol, sizeof(g_erasetoeol)},
|
||||||
{NULL, NULL, 0}
|
{NULL, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ static const struct vt100_sequence_s g_vt100sequences[] =
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_erasetoeol
|
* Name: nxterm_erasetoeol
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Handle the erase-to-eol VT100 escapte sequence
|
* Handle the erase-to-eol VT100 escapte sequence
|
||||||
@@ -107,7 +107,7 @@ static const struct vt100_sequence_s g_vt100sequences[] =
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxcon_erasetoeol(FAR struct nxcon_state_s *priv)
|
static int nxterm_erasetoeol(FAR struct nxterm_state_s *priv)
|
||||||
{
|
{
|
||||||
/* Does nothing yet (other than consume the sequence) */
|
/* Does nothing yet (other than consume the sequence) */
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ static int nxcon_erasetoeol(FAR struct nxcon_state_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_vt100part
|
* Name: nxterm_vt100part
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the next entry that is a partial match to the sequence.
|
* Return the next entry that is a partial match to the sequence.
|
||||||
@@ -131,7 +131,7 @@ static int nxcon_erasetoeol(FAR struct nxcon_state_s *priv)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR const struct vt100_sequence_s *
|
FAR const struct vt100_sequence_s *
|
||||||
nxcon_vt100part(FAR struct nxcon_state_s *priv, int seqsize)
|
nxterm_vt100part(FAR struct nxterm_state_s *priv, int seqsize)
|
||||||
{
|
{
|
||||||
FAR const struct vt100_sequence_s *seq;
|
FAR const struct vt100_sequence_s *seq;
|
||||||
int ndx;
|
int ndx;
|
||||||
@@ -159,7 +159,7 @@ nxcon_vt100part(FAR struct nxcon_state_s *priv, int seqsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_vt100seq
|
* Name: nxterm_vt100seq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Determine if the new sequence is a part of a supported VT100 escape
|
* Determine if the new sequence is a part of a supported VT100 escape
|
||||||
@@ -170,21 +170,21 @@ nxcon_vt100part(FAR struct nxcon_state_s *priv, int seqsize)
|
|||||||
* seqsize - The number of bytes in the sequence
|
* seqsize - The number of bytes in the sequence
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* state - See enum nxcon_vt100state_e;
|
* state - See enum nxterm_vt100state_e;
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static enum nxcon_vt100state_e nxcon_vt100seq(FAR struct nxcon_state_s *priv,
|
static enum nxterm_vt100state_e nxterm_vt100seq(FAR struct nxterm_state_s *priv,
|
||||||
int seqsize)
|
int seqsize)
|
||||||
{
|
{
|
||||||
FAR const struct vt100_sequence_s *seq;
|
FAR const struct vt100_sequence_s *seq;
|
||||||
enum nxcon_vt100state_e ret;
|
enum nxterm_vt100state_e ret;
|
||||||
|
|
||||||
/* Is there any VT100 escape sequence that matches what we have
|
/* Is there any VT100 escape sequence that matches what we have
|
||||||
* buffered so far?
|
* buffered so far?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
seq = nxcon_vt100part(priv, seqsize);
|
seq = nxterm_vt100part(priv, seqsize);
|
||||||
if (seq)
|
if (seq)
|
||||||
{
|
{
|
||||||
/* Yes.. if the size of that escape sequence is the same as what we
|
/* Yes.. if the size of that escape sequence is the same as what we
|
||||||
@@ -223,7 +223,7 @@ static enum nxcon_vt100state_e nxcon_vt100seq(FAR struct nxcon_state_s *priv,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_vt100
|
* Name: nxterm_vt100
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Test if the newly received byte is part of a VT100 escape sequence
|
* Test if the newly received byte is part of a VT100 escape sequence
|
||||||
@@ -233,13 +233,13 @@ static enum nxcon_vt100state_e nxcon_vt100seq(FAR struct nxcon_state_s *priv,
|
|||||||
* ch - The newly received character
|
* ch - The newly received character
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* state - See enum nxcon_vt100state_e;
|
* state - See enum nxterm_vt100state_e;
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
enum nxcon_vt100state_e nxcon_vt100(FAR struct nxcon_state_s *priv, char ch)
|
enum nxterm_vt100state_e nxterm_vt100(FAR struct nxterm_state_s *priv, char ch)
|
||||||
{
|
{
|
||||||
enum nxcon_vt100state_e ret;
|
enum nxterm_vt100state_e ret;
|
||||||
int seqsize;
|
int seqsize;
|
||||||
|
|
||||||
DEBUGASSERT(priv && priv->nseq < VT100_MAX_SEQUENCE);
|
DEBUGASSERT(priv && priv->nseq < VT100_MAX_SEQUENCE);
|
||||||
@@ -276,7 +276,7 @@ enum nxcon_vt100state_e nxcon_vt100(FAR struct nxcon_state_s *priv, char ch)
|
|||||||
/* Then check if this sequence is part of an a valid escape sequence */
|
/* Then check if this sequence is part of an a valid escape sequence */
|
||||||
|
|
||||||
seqsize++;
|
seqsize++;
|
||||||
ret = nxcon_vt100seq(priv, seqsize);
|
ret = nxterm_vt100seq(priv, seqsize);
|
||||||
if (ret == VT100_CONSUMED)
|
if (ret == VT100_CONSUMED)
|
||||||
{
|
{
|
||||||
/* The newly added character is indeed part of a VT100 escape sequence
|
/* The newly added character is indeed part of a VT100 escape sequence
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
#include <nuttx/nx/nxtk.h>
|
#include <nuttx/nx/nxtk.h>
|
||||||
#include <nuttx/nx/nxterm.h>
|
#include <nuttx/nx/nxterm.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -52,15 +52,15 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxtkcon_fill(FAR struct nxcon_state_s *priv,
|
static int nxtkcon_fill(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
static int nxtkcon_move(FAR struct nxcon_state_s *priv,
|
static int nxtkcon_move(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset);
|
FAR const struct nxgl_point_s *offset);
|
||||||
#endif
|
#endif
|
||||||
static int nxtkcon_bitmap(FAR struct nxcon_state_s *priv,
|
static int nxtkcon_bitmap(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -70,7 +70,7 @@ static int nxtkcon_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static const struct nxcon_operations_s g_nxtkops =
|
static const struct nxterm_operations_s g_nxtkops =
|
||||||
{
|
{
|
||||||
nxtkcon_fill,
|
nxtkcon_fill,
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
@@ -99,7 +99,7 @@ static const struct nxcon_operations_s g_nxtkops =
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxtkcon_fill(FAR struct nxcon_state_s *priv,
|
static int nxtkcon_fill(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ static int nxtkcon_fill(FAR struct nxcon_state_s *priv,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
static int nxtkcon_move(FAR struct nxcon_state_s *priv,
|
static int nxtkcon_move(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset)
|
FAR const struct nxgl_point_s *offset)
|
||||||
{
|
{
|
||||||
@@ -155,7 +155,7 @@ static int nxtkcon_move(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxtkcon_bitmap(FAR struct nxcon_state_s *priv,
|
static int nxtkcon_bitmap(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -186,7 +186,7 @@ static int nxtkcon_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
NXTERM nxtk_register(NXTKWINDOW hfwnd, FAR struct nxcon_window_s *wndo, int minor)
|
NXTERM nxtk_register(NXTKWINDOW hfwnd, FAR struct nxterm_window_s *wndo, int minor)
|
||||||
{
|
{
|
||||||
return nxcon_register((NXTERM)hfwnd, wndo, &g_nxtkops, minor);
|
return nxterm_register((NXTERM)hfwnd, wndo, &g_nxtkops, minor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include <nuttx/nx/nxtk.h>
|
#include <nuttx/nx/nxtk.h>
|
||||||
#include <nuttx/nx/nxterm.h>
|
#include <nuttx/nx/nxterm.h>
|
||||||
|
|
||||||
#include "nxcon_internal.h"
|
#include "nxterm.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -52,15 +52,15 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxtool_fill(FAR struct nxcon_state_s *priv,
|
static int nxtool_fill(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]);
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
static int nxtool_move(FAR struct nxcon_state_s *priv,
|
static int nxtool_move(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset);
|
FAR const struct nxgl_point_s *offset);
|
||||||
#endif
|
#endif
|
||||||
static int nxtool_bitmap(FAR struct nxcon_state_s *priv,
|
static int nxtool_bitmap(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -70,7 +70,7 @@ static int nxtool_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static const struct nxcon_operations_s g_nxtoolops =
|
static const struct nxterm_operations_s g_nxtoolops =
|
||||||
{
|
{
|
||||||
nxtool_fill,
|
nxtool_fill,
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
@@ -99,7 +99,7 @@ static const struct nxcon_operations_s g_nxtoolops =
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxtool_fill(FAR struct nxcon_state_s *priv,
|
static int nxtool_fill(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES])
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ static int nxtool_fill(FAR struct nxcon_state_s *priv,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_NX_WRITEONLY
|
#ifndef CONFIG_NX_WRITEONLY
|
||||||
static int nxtool_move(FAR struct nxcon_state_s *priv,
|
static int nxtool_move(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct nxgl_rect_s *rect,
|
||||||
FAR const struct nxgl_point_s *offset)
|
FAR const struct nxgl_point_s *offset)
|
||||||
{
|
{
|
||||||
@@ -155,7 +155,7 @@ static int nxtool_move(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int nxtool_bitmap(FAR struct nxcon_state_s *priv,
|
static int nxtool_bitmap(FAR struct nxterm_state_s *priv,
|
||||||
FAR const struct nxgl_rect_s *dest,
|
FAR const struct nxgl_rect_s *dest,
|
||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin,
|
FAR const struct nxgl_point_s *origin,
|
||||||
@@ -188,8 +188,8 @@ static int nxtool_bitmap(FAR struct nxcon_state_s *priv,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
NXTERM nxtool_register(NXTKWINDOW hfwnd, FAR struct nxcon_window_s *wndo, int minor)
|
NXTERM nxtool_register(NXTKWINDOW hfwnd, FAR struct nxterm_window_s *wndo, int minor)
|
||||||
{
|
{
|
||||||
return nxcon_register((NXTERM)hfwnd, wndo, &g_nxtoolops, minor);
|
return nxterm_register((NXTERM)hfwnd, wndo, &g_nxtoolops, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-18
@@ -100,7 +100,7 @@
|
|||||||
* CONFIG_NXTERM_NXKBDIN
|
* CONFIG_NXTERM_NXKBDIN
|
||||||
* Take input from the NX keyboard input callback. By default, keyboard
|
* Take input from the NX keyboard input callback. By default, keyboard
|
||||||
* input is taken from stdin (/dev/console). If this option is set, then
|
* input is taken from stdin (/dev/console). If this option is set, then
|
||||||
* the interface nxcon_kbdin() is enabled. That interface may be driven
|
* the interface nxterm_kbdin() is enabled. That interface may be driven
|
||||||
* by window callback functions so that keyboard input *only* goes to the
|
* by window callback functions so that keyboard input *only* goes to the
|
||||||
* top window.
|
* top window.
|
||||||
* CONFIG_NXTERM_KBDBUFSIZE
|
* CONFIG_NXTERM_KBDBUFSIZE
|
||||||
@@ -193,7 +193,7 @@ typedef FAR void *NXTERM;
|
|||||||
|
|
||||||
/* This structure describes the window and font characteristics */
|
/* This structure describes the window and font characteristics */
|
||||||
|
|
||||||
struct nxcon_window_s
|
struct nxterm_window_s
|
||||||
{
|
{
|
||||||
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window background color */
|
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window background color */
|
||||||
nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */
|
nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */
|
||||||
@@ -208,7 +208,8 @@ struct nxcon_window_s
|
|||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
# define EXTERN extern "C"
|
# define EXTERN extern "C"
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
# define EXTERN extern
|
# define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
@@ -222,7 +223,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register a console device on a raw NX window. The device will be
|
* Register a console device on a raw NX window. The device will be
|
||||||
* registered at /dev/nxconN where N is the provided minor number.
|
* registered at /dev/nxtermN where N is the provided minor number.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* hwnd - A handle that will be used to access the window. The window must
|
* hwnd - A handle that will be used to access the window. The window must
|
||||||
@@ -237,7 +238,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN NXTERM nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo,
|
NXTERM nx_register(NXWINDOW hwnd, FAR struct nxterm_window_s *wndo,
|
||||||
int minor);
|
int minor);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -245,7 +246,7 @@ EXTERN NXTERM nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo,
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register a console device on a framed NX window. The device will be
|
* Register a console device on a framed NX window. The device will be
|
||||||
* registered at /dev/nxconN where N is the provided minor number.
|
* registered at /dev/nxtermN where N is the provided minor number.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* hfwnd - A handle that will be used to access the window. The window must
|
* hfwnd - A handle that will be used to access the window. The window must
|
||||||
@@ -260,15 +261,15 @@ EXTERN NXTERM nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN NXTERM nxtk_register(NXTKWINDOW hfwnd,
|
NXTERM nxtk_register(NXTKWINDOW hfwnd, FAR struct nxterm_window_s *wndo,
|
||||||
FAR struct nxcon_window_s *wndo, int minor);
|
int minor);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxtool_register
|
* Name: nxtool_register
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register a console device on a toolbar of a framed NX window. The
|
* 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
|
* device will be registered at /dev/nxtermN where N is the provided minor
|
||||||
* number.
|
* number.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
@@ -285,11 +286,11 @@ EXTERN NXTERM nxtk_register(NXTKWINDOW hfwnd,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN NXTERM nxtool_register(NXTKWINDOW hfwnd,
|
NXTERM nxtool_register(NXTKWINDOW hfwnd, FAR struct nxterm_window_s *wndo,
|
||||||
FAR struct nxcon_window_s *wndo, int minor);
|
int minor);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_unregister
|
* Name: nxterm_unregister
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Un-register to NX console device.
|
* Un-register to NX console device.
|
||||||
@@ -303,10 +304,10 @@ EXTERN NXTERM nxtool_register(NXTKWINDOW hfwnd,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN void nxcon_unregister(NXTERM handle);
|
void nxterm_unregister(NXTERM handle);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_redraw
|
* Name: nxterm_redraw
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Re-draw a portion of the NX console. This function should be called
|
* Re-draw a portion of the NX console. This function should be called
|
||||||
@@ -324,11 +325,11 @@ EXTERN void nxcon_unregister(NXTERM handle);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN void nxcon_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect,
|
void nxterm_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect,
|
||||||
bool more);
|
bool more);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxcon_kbdin
|
* Name: nxterm_kbdin
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function should be driven by the window kbdin callback function
|
* This function should be driven by the window kbdin callback function
|
||||||
@@ -354,8 +355,7 @@ EXTERN void nxcon_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||||
EXTERN void nxcon_kbdin(NXTERM handle, FAR const uint8_t *buffer,
|
void nxterm_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen);
|
||||||
uint8_t buflen);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
Reference in New Issue
Block a user