diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-03-30 18:42:40 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-03-30 18:42:40 +0000 |
commit | 6542745de8fbe0f90de06052821c6d78ab183250 (patch) | |
tree | 5ab49f724ed67d3506856d404b0cd3c03f8fea86 /nuttx/graphics/nxconsole/nxcon_internal.h | |
parent | 55d55c1e70122ede4fd25d8aa826e48f7506095b (diff) | |
download | px4-firmware-6542745de8fbe0f90de06052821c6d78ab183250.tar.gz px4-firmware-6542745de8fbe0f90de06052821c6d78ab183250.tar.bz2 px4-firmware-6542745de8fbe0f90de06052821c6d78ab183250.zip |
Add framework in NxConsole to support VT100 escape sequences
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4542 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/graphics/nxconsole/nxcon_internal.h')
-rw-r--r-- | nuttx/graphics/nxconsole/nxcon_internal.h | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/nuttx/graphics/nxconsole/nxcon_internal.h b/nuttx/graphics/nxconsole/nxcon_internal.h index 62ae71705..996ea9d5d 100644 --- a/nuttx/graphics/nxconsole/nxcon_internal.h +++ b/nuttx/graphics/nxconsole/nxcon_internal.h @@ -58,25 +58,38 @@ /* NxConsole Definitions ****************************************************/ /* Bitmap flags */ -#define BMFLAGS_NOGLYPH (1 << 0) /* No glyph available, use space */ -#define BM_ISSPACE(bm) (((bm)->flags & BMFLAGS_NOGLYPH) != 0) +#define BMFLAGS_NOGLYPH (1 << 0) /* No glyph available, use space */ +#define BM_ISSPACE(bm) (((bm)->flags & BMFLAGS_NOGLYPH) != 0) /* Sizes and maximums */ -#define MAX_USECNT 255 /* Limit to range of a uint8_t */ +#define MAX_USECNT 255 /* Limit to range of a uint8_t */ /* Device path formats */ -#define NX_DEVNAME_FORMAT "/dev/nxcon%d" -#define NX_DEVNAME_SIZE 16 +#define NX_DEVNAME_FORMAT "/dev/nxcon%d" +#define NX_DEVNAME_SIZE 16 /* Semaphore protection */ -#define NO_HOLDER (pid_t)-1 +#define NO_HOLDER (pid_t)-1 + +/* VT100 escape sequence processing */ + +#define VT100_MAX_SEQUENCE 3 /**************************************************************************** * Public Types ****************************************************************************/ +/* Identifies the state of the VT100 escape sequence processing */ + +enum nxcon_vt100state_e +{ + 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_PROCESSED, /* The full VT100 escape sequence was processed */ + VT100_ABORT /* Invalid/unsupported character in buffered escape sequence */ +}; /* Describes on set of console window callbacks */ @@ -146,6 +159,11 @@ struct nxcon_state_s uint8_t maxglyphs; /* Size of the glyph[] array */ #endif + /* VT100 escape sequence processing */ + + char seq[VT100_MAX_SEQUENCE]; /* Buffered characters */ + uint8_t nseq; /* Number of buffered characters */ + /* Font cache data storage */ struct nxcon_bitmap_s bm[CONFIG_NXCONSOLE_MXCHARS]; @@ -188,13 +206,19 @@ FAR struct nxcon_state_s *nxcon_register(NXCONSOLE handle, FAR struct nxcon_window_s *wndo, FAR const struct nxcon_operations_s *ops, int minor); +/* VT100 Terminal emulation */ + +enum nxcon_vt100state_e nxcon_vt100(FAR struct nxcon_state_s *priv, char ch); + /* Generic text display helpers */ void nxcon_home(FAR struct nxcon_state_s *priv); void nxcon_newline(FAR struct nxcon_state_s *priv); void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch); +FAR const struct nxcon_bitmap_s *nxcon_addchar(NXHANDLE hfont, + FAR struct nxcon_state_s *priv, uint8_t ch); void nxcon_fillchar(FAR struct nxcon_state_s *priv, - FAR const struct nxgl_rect_s *rect, FAR const struct nxcon_bitmap_s *bm); + FAR const struct nxgl_rect_s *rect, FAR const struct nxcon_bitmap_s *bm); /* Scrolling support */ |