From eb8c7f16417bd033da75e0ba4edbe2821d1f417a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 08:16:33 -0600 Subject: [PATCH 01/22] VNC: Correct pixel width in RRE encoding --- graphics/vnc/server/vnc_negotiate.c | 11 +- graphics/vnc/server/vnc_rre.c | 208 +++++++++++++++++++++------- graphics/vnc/server/vnc_server.h | 9 +- include/nuttx/video/rfb.h | 50 +++++++ 4 files changed, 219 insertions(+), 59 deletions(-) diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index bf3671bd1d0..bb6aff34f4a 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -384,12 +384,13 @@ int vnc_negotiate(FAR struct vnc_session_s *session) } else if (setformat->msgtype != RFB_SETPIXELFMT_MSG) { - gdbg("ERROR: Not a SetPixelFormat message: %d\n", (int)setformat->msgtype); + gdbg("ERROR: Not a SetPixelFormat message: %d\n", + (int)setformat->msgtype); return -EPROTO; } - /* Instantiate the client pixel format, verifying that the client request format - * is one that we can handle. + /* Instantiate the client pixel format, verifying that the client request + * format is one that we can handle. */ ret = vnc_client_pixelformat(session, &setformat->format); @@ -408,7 +409,7 @@ int vnc_negotiate(FAR struct vnc_session_s *session) encodings = (FAR struct rfb_setencodings_s *)session->inbuf; nrecvd = psock_recv(&session->connect, encodings, - CONFIG_VNCSERVER_INBUFFER_SIZE, 0); + CONFIG_VNCSERVER_INBUFFER_SIZE, 0); if (nrecvd < 0) { errcode = get_errno(); @@ -419,7 +420,7 @@ int vnc_negotiate(FAR struct vnc_session_s *session) if (nrecvd > 0 && encodings->msgtype == RFB_SETENCODINGS_MSG) { - DEBUGASSERT(nrecvd >= SIZEOF_RFB_SETENCODINGS_S(0)); + DEBUGASSERT(nrecvd >= SIZEOF_RFB_SETENCODINGS_S(0)); /* Pick out any mutually supported encodings */ diff --git a/graphics/vnc/server/vnc_rre.c b/graphics/vnc/server/vnc_rre.c index a271efa9d69..f012fae2a4a 100644 --- a/graphics/vnc/server/vnc_rre.c +++ b/graphics/vnc/server/vnc_rre.c @@ -50,35 +50,119 @@ * Private Types ****************************************************************************/ -struct rre_data_s +struct rre_encode8_s { -#if RFB_BITSPERPIXEL == 16 - struct rfb_rrehdr16_s hdr; /* Header with background pixel */ - struct rfb_rrerect16_s srect; /* Sub-rectangle */ -#elif RFB_BITSPERPIXEL == 32 - struct rfb_rrehdr32_s hdr; /* Header with background pixel */ - struct rfb_rrerect32_s srect; /* Sub-rectangle */ -#endif + struct rfb_rrehdr8_s hdr; + struct rfb_rrerect8_s rect; }; -struct rre_rectangle_s +struct rre_encode16_s { - uint8_t xpos[2]; /* U16 X position */ - uint8_t ypos[2]; /* U16 Y position */ - uint8_t width[2]; /* U16 Width */ - uint8_t height[2]; /* U16 Height */ - uint8_t encoding[4]; /* S32 Encoding type = RFB_ENCODING_RRE */ - struct rre_data_s data; /* Pixel data, actual size varies */ + struct rfb_rrehdr16_s hdr; + struct rfb_rrerect16_s rect; }; -struct rre_framebufferupdate_s +struct rre_encode32_s { - uint8_t msgtype; /* U8 Message type = RFB_FBUPDATE_MSG*/ - uint8_t padding; - uint8_t nrect[2]; /* U16 Number of rectangles = 1*/ - struct rre_rectangle_s rect; /* RRE encoded rectangle */ + struct rfb_rrehdr32_s hdr; + struct rfb_rrerect32_s rect; }; +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: vnc_rreNN + * + * Description: + * Encode a single RRE sub-rectangle, NN=bits-per-pixel + * + * Input Parameters: + * session - An instance of the session structure. + * dest - The locate to save the RRE encoded data + * rect - Describes the rectangle in the local framebuffer. + * bgcolor - The local color of the pixel data + * + * Returned Value: + * The size of the framebuffer update message is returned.. + * + ****************************************************************************/ + +ssize_t vnc_rre8(FAR struct vnc_session_s *session, + FAR struct rre_encode8_s *dest, + FAR struct nxgl_rect_s *rect, + uint8_t bgcolor) +{ + nxgl_coord_t width; + nxgl_coord_t height; + + rfb_putbe32(dest->hdr.nsubrects, 1); + dest->hdr.pixel = bgcolor; + + dest->rect.pixel = bgcolor; + rfb_putbe16(dest->rect.xpos, rect->pt1.x); + rfb_putbe16(dest->rect.ypos, rect->pt1.y); + + width = rect->pt2.x - rect->pt1.x + 1; + height = rect->pt2.y - rect->pt1.y + 1; + + rfb_putbe16(dest->rect.width, width); + rfb_putbe16(dest->rect.height, height); + + return sizeof(struct rre_encode8_s); +} + +ssize_t vnc_rre16(FAR struct vnc_session_s *session, + FAR struct rre_encode16_s *dest, + FAR struct nxgl_rect_s *rect, + uint16_t bgcolor) +{ + nxgl_coord_t width; + nxgl_coord_t height; + + rfb_putbe32(dest->hdr.nsubrects, 1); + rfb_putbe16(dest->hdr.pixel, bgcolor); + + rfb_putbe16(dest->rect.pixel, bgcolor); + rfb_putbe16(dest->rect.xpos, rect->pt1.x); + rfb_putbe16(dest->rect.xpos, rect->pt1.x); + rfb_putbe16(dest->rect.ypos, rect->pt1.y); + + width = rect->pt2.x - rect->pt1.x + 1; + height = rect->pt2.y - rect->pt1.y + 1; + + rfb_putbe16(dest->rect.width, width); + rfb_putbe16(dest->rect.height, height); + + return sizeof(struct rre_encode16_s); +} + +ssize_t vnc_rre32(FAR struct vnc_session_s *session, + FAR struct rre_encode32_s *dest, + FAR struct nxgl_rect_s *rect, + uint32_t bgcolor) +{ + nxgl_coord_t width; + nxgl_coord_t height; + + rfb_putbe32(dest->hdr.nsubrects, 1); + rfb_putbe32(dest->hdr.pixel, bgcolor); + + rfb_putbe32(dest->rect.pixel, bgcolor); + rfb_putbe16(dest->rect.xpos, rect->pt1.x); + rfb_putbe16(dest->rect.xpos, rect->pt1.x); + rfb_putbe16(dest->rect.ypos, rect->pt1.y); + + width = rect->pt2.x - rect->pt1.x + 1; + height = rect->pt2.y - rect->pt1.y + 1; + + rfb_putbe16(dest->rect.width, width); + rfb_putbe16(dest->rect.height, height); + + return sizeof(struct rre_encode32_s); +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -97,22 +181,21 @@ struct rre_framebufferupdate_s * * Returned Value: * Zero is returned if RRE coding was not performed (but not error was) - * encountered. Otherwise, eith the size of the framebuffer update - * message is returned on success or a negated errno value is returned on - * failure that indicates the the nature of the failure. A failure is - * only returned in cases of a network failure and unexpected internal - * failures. + * encountered. Otherwise, the size of the framebuffer update message + * is returned on success or a negated errno value is returned on failure + * that indicates the the nature of the failure. A failure is only + * returned in cases of a network failure and unexpected internal failures. * ****************************************************************************/ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) { - FAR struct rre_framebufferupdate_s *rre; - FAR struct rre_rectangle_s *rrect; - FAR struct rre_data_s *rdata; + FAR struct rfb_framebufferupdate_s *rre; + FAR struct rfb_rectangle_s *rrect; lfb_color_t bgcolor; nxgl_coord_t width; nxgl_coord_t height; + size_t nbytes; ssize_t nsent; int ret; @@ -125,38 +208,66 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) ret = vnc_colors(session, rect, 1, &bgcolor); if (ret == 1) { - width = rect->pt2.x - rect->pt1.x + 1; - height = rect->pt2.y - rect->pt1.y + 1; + width = rect->pt2.x - rect->pt1.x + 1; + height = rect->pt2.y - rect->pt1.y + 1; /* Format the FrameBuffer Update with a single RRE encoded * rectangle. */ - rre = (FAR struct rre_framebufferupdate_s *)session->outbuf; + rre = (FAR struct rfb_framebufferupdate_s *)session->outbuf; rre->msgtype = RFB_FBUPDATE_MSG; rre->padding = 0; rfb_putbe16(rre->nrect, 1); - rrect = (FAR struct rre_rectangle_s *)&rre->rect; + rrect = (FAR struct rfb_rectangle_s *)&rre->rect; rfb_putbe16(rrect->xpos, rect->pt1.x); rfb_putbe16(rrect->ypos, rect->pt1.y); rfb_putbe16(rrect->width, width); rfb_putbe16(rrect->height, height); rfb_putbe32(rrect->encoding, RFB_ENCODING_RRE); - rdata = (FAR struct rre_data_s *)&rrect->data; - rfb_putbe32(rdata->hdr.nsubrects, 1); -#if RFB_BITSPERPIXEL == 16 - rfb_putbe16(rdata->hdr.pixel, bgcolor); - rfb_putbe16(rdata->srect.pixel, bgcolor); -#elif RFB_BITSPERPIXEL == 32 - rfb_putbe32(rdata->hdr.pixel, bgcolor); - rfb_putbe32(rdata->srect.pixel, bgcolor); -#endif - rfb_putbe16(rdata->srect.xpos, rect->pt1.x); - rfb_putbe16(rdata->srect.ypos, rect->pt1.y); - rfb_putbe16(rdata->srect.width, width); - rfb_putbe16(rdata->srect.height, height); + /* The sub-rectangle encoding depends of the remote pixel width */ + + nbytes = SIZEOF_RFB_FRAMEBUFFERUPDATE_S(SIZEOF_RFB_RECTANGE_S(0)); + + switch (session->colorfmt) + { + case FB_FMT_RGB8_222: + nbytes += vnc_rre8(session, + (FAR struct rre_encode8_s *)rrect->data, + rect, vnc_convert_rgb8_222(bgcolor)); + break; + + case FB_FMT_RGB8_332: + nbytes += vnc_rre8(session, + (FAR struct rre_encode8_s *)rrect->data, + rect, vnc_convert_rgb8_332(bgcolor)); + break; + + case FB_FMT_RGB16_555: + nbytes += vnc_rre16(session, + (FAR struct rre_encode16_s *)rrect->data, + rect, vnc_convert_rgb16_555(bgcolor)); + break; + + case FB_FMT_RGB16_565: + nbytes += vnc_rre16(session, + (FAR struct rre_encode16_s *)rrect->data, + rect, vnc_convert_rgb16_565(bgcolor)); + break; + + case FB_FMT_RGB32: + nbytes += vnc_rre32(session, + (FAR struct rre_encode32_s *)rrect->data, + rect, vnc_convert_rgb32_888(bgcolor)); + break; + + default: + gdbg("ERROR: Unrecognized color format: %d\n", + session->colorfmt); + return -EINVAL; + } /* At the very last most, make certain that the supported encoding * has not changed asynchronously. @@ -169,8 +280,7 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) * and there are a limited number of IOBs available. */ - nsent = psock_send(&session->connect, rre, - sizeof(struct rre_framebufferupdate_s), 0); + nsent = psock_send(&session->connect, rre, nbytes, 0); if (nsent < 0) { int errcode = get_errno(); @@ -180,8 +290,8 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) return -errcode; } - DEBUGASSERT(nsent == sizeof(struct rre_framebufferupdate_s)); - return sizeof(struct rre_framebufferupdate_s); + DEBUGASSERT(nsent == nbytes); + return nbytes; } return -EINVAL; diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index 9b7b0596152..86e5d46e2e6 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -455,11 +455,10 @@ int vnc_receiver(FAR struct vnc_session_s *session); * * Returned Value: * Zero is returned if RRE coding was not performed (but not error was) - * encountered. Otherwise, eith the size of the framebuffer update - * message is returned on success or a negated errno value is returned on - * failure that indicates the the nature of the failure. A failure is - * only returned in cases of a network failure and unexpected internal - * failures. + * encountered. Otherwise, the size of the framebuffer update message + * is returned on success or a negated errno value is returned on failure + * that indicates the the nature of the failure. A failure is only + * returned in cases of a network failure and unexpected internal failures. * ****************************************************************************/ diff --git a/include/nuttx/video/rfb.h b/include/nuttx/video/rfb.h index 02e15b143f0..73f5477611d 100644 --- a/include/nuttx/video/rfb.h +++ b/include/nuttx/video/rfb.h @@ -691,6 +691,12 @@ struct rfb_copyrect_encoding_s * the header:" */ +struct rfb_rrehdr8_s +{ + uint8_t nsubrects[4]; /* U32 Number of sub-rectangle */ + uint8_t pixel; /* U8 Background pixel */ +}; + struct rfb_rrehdr16_s { uint8_t nsubrects[4]; /* U32 Number of sub-rectangle */ @@ -707,6 +713,15 @@ struct rfb_rrehdr32_s * structure:" */ +struct rfb_rrerect8_s +{ + uint8_t pixel; /* U8 sub-rect pixel value */ + uint8_t xpos[2]; /* U16 X position */ + uint8_t ypos[2]; /* U16 Y position */ + uint8_t width[2]; /* U16 Width */ + uint8_t height[2]; /* U16 Height */ +}; + struct rfb_rrerect16_s { uint8_t pixel[2]; /* U16 sub-rect pixel value */ @@ -771,6 +786,11 @@ struct rfb_rrerect32_s * background colour for this tile:" */ +struct rfb_backpixel8_s +{ + uint8_t pixel; /* U8 Background pixel value */ +}; + struct rfb_backpixel16_s { uint8_t pixel[2]; /* U16 Background pixel value */ @@ -788,6 +808,11 @@ struct rfb_backpixel32_s * foreground colour to be used for all subrectangles in this tile:" */ +struct rfb_forepixel8_s +{ + uint8_t pixel; /* U8 Foreground pixel value */ +}; + struct rfb_forepixel16_s { uint8_t pixel[2]; /* U16 Foreground pixel value */ @@ -816,6 +841,13 @@ struct rfb_nrects_s * value giving the colour of that subrectangle, so a subrectangle is:" */ +struct rfb_subrectscolored8_s +{ + uint8_t pixel; /* U8 Sub-rect pixel value */ + uint8_t xy; /* U8 X and y position */ + uint8_t wh; /* U8 Width and height */ +}; + struct rfb_subrectscolored16_s { uint8_t pixel[2]; /* U16 Sub-rect pixel value */ @@ -916,6 +948,14 @@ struct rfb_srle_s * height are the width and height of the tile):" */ +struct rfb_rawpixel8_s +{ + uint8_t pixels[1]; /* Actual size is w*h */ +}; + +#define SIZEOF_RFB_RAWPIXEL8_S(n,r) \ + (sizeof(struct rfb_rawpixel8_s) + (n) - 1) + struct rfb_rawpixel16_s { uint8_t pixels[2]; /* Actual size is 2*w*h */ @@ -934,6 +974,11 @@ struct rfb_rawpixel32_s /* "A solid tile consisting of a single colour. The pixel value follows:" */ +struct rfb_solid8_s +{ + uint8_t pixels; /* Pixel value */ +}; + struct rfb_solid16_s { uint8_t pixels[2]; /* Pixel value */ @@ -977,6 +1022,11 @@ struct rfb_solid32_s * (subencoding − 128) pixel values:" */ +struct rfb_palette8_s +{ + uint8_t palette[1]; /* Actual size is palleteSize */ +}; + struct rfb_palette16_s { uint8_t palette[2]; /* Actual size is 2*palleteSize */ From a9af1946884651c4ef4ccf79edf259ce8e3aadb0 Mon Sep 17 00:00:00 2001 From: SP Date: Thu, 21 Apr 2016 08:27:27 -0600 Subject: [PATCH 02/22] ChangeLog: Correct typo --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9e5fe24708f..ed8dd467b11 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11376,7 +11376,7 @@ I2C_READ and I2C_WRITE which are not thread safe (2016-01-26). * SPI: Rename the STM32 up_spiinitialize() to stm32_spibus_initialize() (2016-01-26). - * SPI: Rename the SAM up_spiinitialize() to stm32_spibus_initialize() + * SPI: Rename the SAM up_spiinitialize() to sam_spibus_initialize() (2016-01-26). * SPI: Rename the Tiva up_spiinitialize() to tiva_spibus_intialize() (2016-01-26). From 98e4de73e2dd02807476a839d33334b313422276 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 09:47:26 -0600 Subject: [PATCH 03/22] VNC: Discard previously queued updates if the client requesta a whole screen update --- graphics/vnc/server/Kconfig | 7 ++- graphics/vnc/server/vnc_raw.c | 3 ++ graphics/vnc/server/vnc_rre.c | 2 + graphics/vnc/server/vnc_server.h | 28 +++++++++++ graphics/vnc/server/vnc_updater.c | 79 +++++++++++++++++++++++-------- 5 files changed, 99 insertions(+), 20 deletions(-) diff --git a/graphics/vnc/server/Kconfig b/graphics/vnc/server/Kconfig index a7ea00c2613..17a5e3d8ab5 100644 --- a/graphics/vnc/server/Kconfig +++ b/graphics/vnc/server/Kconfig @@ -124,7 +124,12 @@ config VNCSERVER_KBDENCODE include/nuttx/input/kbd_coded.h. config VNCSERVER_INBUFFER_SIZE - int "Input buffer size + int "Input buffer size" default 80 +config VNCSERVER_UPDATE_DEBUG + bool "Detailed updater debug" + default n + depends on DEBUG_GRAPHICS + endif # VNCSERVER diff --git a/graphics/vnc/server/vnc_raw.c b/graphics/vnc/server/vnc_raw.c index 7d49a013f03..f54428df429 100644 --- a/graphics/vnc/server/vnc_raw.c +++ b/graphics/vnc/server/vnc_raw.c @@ -454,6 +454,9 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) size -= nsent; } while (size > 0); + + updvdbg("Sent {(%d, %d),(%d, %d)}\n", + x, y, x + updwidth -1, y + updheight - 1); } } } diff --git a/graphics/vnc/server/vnc_rre.c b/graphics/vnc/server/vnc_rre.c index f012fae2a4a..0ccb841f869 100644 --- a/graphics/vnc/server/vnc_rre.c +++ b/graphics/vnc/server/vnc_rre.c @@ -291,6 +291,8 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) } DEBUGASSERT(nsent == nbytes); + updvdbg("Sent {(%d, %d),(%d, %d)}\n", + rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y); return nbytes; } diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index 86e5d46e2e6..f17dd752552 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -181,6 +181,34 @@ # define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif +/* Debug */ + +#ifdef CONFIG_VNCSERVER_UPDATE_DEBUG +# ifdef CONFIG_CPP_HAVE_VARARGS +# define upddbg(format, ...) dbg(format, ##__VA_ARGS__) +# define updlldbg(format, ...) lldbg(format, ##__VA_ARGS__) +# define updvdbg(format, ...) vdbg(format, ##__VA_ARGS__) +# define updllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__) +# else +# define upddbg dbg +# define updlldbg lldbg +# define updvdbg vdbg +# define updllvdbg llvdbg +# endif +#else +# ifdef CONFIG_CPP_HAVE_VARARGS +# define upddbg(x...) +# define updlldbg(x...) +# define updvdbg(x...) +# define updllvdbg(x...) +# else +# define upddbg (void) +# define updlldbg (void) +# define updvdbg (void) +# define updllvdbg (void) +# endif +#endif + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index a93f6c3b81a..d41107f15c7 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -47,6 +47,8 @@ #include #include +#include + #include "vnc_server.h" /**************************************************************************** @@ -63,6 +65,20 @@ static sem_t g_dbgsem = SEM_INITIALIZER(1); #endif +/* A rectangle represent the entire local framebuffer */ + +static const struct nxgl_rect_s g_wholescreen = +{ + { + 0, + 0 + }, + { + CONFIG_VNCSERVER_SCREENWIDTH - 1, + CONFIG_VNCSERVER_SCREENHEIGHT - 1 + } +}; + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -325,6 +341,10 @@ static FAR void *vnc_updater(FAR void *arg) srcrect = vnc_remove_queue(session); DEBUGASSERT(srcrect != NULL); + updvdbg("Dequeued {(%d, %d),(%d, %d)}\n", + srcrect->rect.pt1.x, srcrect->rect.pt1.y, + srcrect->rect.pt2.x, srcrect->rect.pt2.y); + /* Attempt to use RRE encoding */ ret = vnc_rre(session, &srcrect->rect); @@ -465,37 +485,58 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, FAR const struct nxgl_rect_s *rect) { FAR struct vnc_fbupdate_s *update; + struct nxgl_rect_s intersection; - /* Make sure that the rectangle has a area */ + /* Clip rectangle to the screen dimensions */ - if (!nxgl_nullrect(rect)) + nxgl_rectintersect(&intersection, rect, &g_wholescreen); + + /* Make sure that the clipped rectangle has a area */ + + if (!nxgl_nullrect(&intersection)) { + /* Check for a whole screen update. The RealVNC client sends a lot + * of these (especially when it is confused) + */ + + sched_lock(); + if (memcmp(&intersection, &g_wholescreen, sizeof(struct nxgl_rect_s)) == 0) + { + FAR struct vnc_fbupdate_s *curr; + FAR struct vnc_fbupdate_s *next; + + /* Yes.. discard all of the previously queued updates */ + + updvdbg("Whole screen update...\n"); + + curr = (FAR struct vnc_fbupdate_s *)session->updqueue.head; + sq_init(&session->updqueue); + sem_reset(&session->queuesem, 0); + + for (; curr != NULL; curr = next) + { + next = curr->flink; + vnc_free_update(session, curr); + } + } + /* Allocate an update structure... waiting if necessary */ update = vnc_alloc_update(session); DEBUGASSERT(update != NULL); - /* Clip and copy the rectangle into the update structure */ + /* Copy the clipped rectangle into the update structure */ - update->rect.pt1.x = MAX(rect->pt1.x, 0); - update->rect.pt1.y = MAX(rect->pt1.y, 0); - update->rect.pt2.x = MIN(rect->pt2.x, (CONFIG_VNCSERVER_SCREENWIDTH - 1)); - update->rect.pt2.y = MIN(rect->pt2.y, (CONFIG_VNCSERVER_SCREENHEIGHT - 1)); + nxgl_rectcopy(&update->rect, &intersection); - /* Make sure that the rectangle still has area after clipping */ + /* Add the upate to the end of the update queue. */ - if (nxgl_nullrect(rect)) - { - /* No.. free the structure and ignore the update */ + vnc_add_queue(session, update); + sched_unlock(); - vnc_free_update(session, update); - } - else - { - /* Yes.. add the upate to the end of the update queue. */ - - vnc_add_queue(session, update); - } + updvdbg("Queued {(%d, %d),(%d, %d)}\n", + intersection.pt1.x, intersection.pt1.y, + intersection.pt2.x, intersection.pt2.y); } /* Since we ignore bad rectangles and wait for updata structures, there is From be1677ba257cd87a77173c068a30d94f64c86e7f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 12:18:35 -0600 Subject: [PATCH 04/22] VNC: Client may request pixel data in either big- or little- endian order --- graphics/vnc/server/vnc_negotiate.c | 30 ++++++++++++--------- graphics/vnc/server/vnc_raw.c | 40 ++++++++++++++++++++++----- graphics/vnc/server/vnc_server.h | 1 + include/nuttx/video/rfb.h | 42 +++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 18 deletions(-) diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index bb6aff34f4a..5014e9a83d2 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -466,37 +466,43 @@ int vnc_client_pixelformat(FAR struct vnc_session_s *session, if (pixelfmt->bpp == 8 && pixelfmt->depth == 6) { gvdbg("Client pixel format: RGB8 2:2:2\n"); - session->colorfmt = FB_FMT_RGB8_222; - session->bpp = 8; + session->colorfmt = FB_FMT_RGB8_222; + session->bpp = 8; + session->bigendian = false; } else if (pixelfmt->bpp == 8 && pixelfmt->depth == 8) { gvdbg("Client pixel format: RGB8 3:3:2\n"); - session->colorfmt = FB_FMT_RGB8_332; - session->bpp = 8; + session->colorfmt = FB_FMT_RGB8_332; + session->bpp = 8; + session->bigendian = false; } else if (pixelfmt->bpp == 16 && pixelfmt->depth == 15) { gvdbg("Client pixel format: RGB16 5:5:5\n"); - session->colorfmt = FB_FMT_RGB16_555; - session->bpp = 16; + session->colorfmt = FB_FMT_RGB16_555; + session->bpp = 16; + session->bigendian = (pixelfmt->bigendian != 0) ? true : false; } else if (pixelfmt->bpp == 16 && pixelfmt->depth == 16) { gvdbg("Client pixel format: RGB16 5:6:5\n"); - session->colorfmt = FB_FMT_RGB16_565; - session->bpp = 16; + session->colorfmt = FB_FMT_RGB16_565; + session->bpp = 16; + session->bigendian = (pixelfmt->bigendian != 0) ? true : false; } else if (pixelfmt->bpp == 32 && pixelfmt->depth == 24) { gvdbg("Client pixel format: RGB32 8:8:8\n"); - session->colorfmt = FB_FMT_RGB32; - session->bpp = 32; + session->colorfmt = FB_FMT_RGB32; + session->bpp = 32; + session->bigendian = (pixelfmt->bigendian != 0) ? true : false; } else if (pixelfmt->bpp == 32 && pixelfmt->depth == 32) { - session->colorfmt = FB_FMT_RGB32; - session->bpp = 32; + session->colorfmt = FB_FMT_RGB32; + session->bpp = 32; + session->bigendian = (pixelfmt->bigendian != 0) ? true : false; } else { diff --git a/graphics/vnc/server/vnc_raw.c b/graphics/vnc/server/vnc_raw.c index f54428df429..64cfee779e6 100644 --- a/graphics/vnc/server/vnc_raw.c +++ b/graphics/vnc/server/vnc_raw.c @@ -135,14 +135,16 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session, FAR struct rfb_framebufferupdate_s *update; FAR const lfb_color_t *srcleft; FAR const lfb_color_t *src; - FAR uint16_t *dest; + FAR uint8_t *dest; + uint16_t pixel; nxgl_coord_t x; nxgl_coord_t y; + bool bigendian; /* Destination rectangle start address */ update = (FAR struct rfb_framebufferupdate_s *)session->outbuf; - dest = (FAR uint16_t *)update->rect[0].data; + dest = (FAR uint8_t *)update->rect[0].data; /* Source rectangle start address (left/top)*/ @@ -150,12 +152,24 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session, /* Transfer each row from the source buffer into the update buffer */ + bigendian = session->bigendian; for (y = 0; y < height; y++) { src = srcleft; for (x = 0; x < width; x++) { - *dest++ = convert(*src); + pixel = convert(*src); + + if (bigendian) + { + rfb_putbe16(dest, pixel); + } + else + { + rfb_putle16(dest, pixel); + } + + dest += sizeof(uint16_t); src++; } @@ -192,14 +206,16 @@ static size_t vnc_copy32(FAR struct vnc_session_s *session, FAR struct rfb_framebufferupdate_s *update; FAR const lfb_color_t *srcleft; FAR const lfb_color_t *src; - FAR uint32_t *dest; + FAR uint8_t *dest; nxgl_coord_t x; nxgl_coord_t y; + uint32_t pixel; + bool bigendian; /* Destination rectangle start address */ update = (FAR struct rfb_framebufferupdate_s *)session->outbuf; - dest = (FAR uint32_t *)update->rect[0].data; + dest = (FAR uint8_t *)update->rect[0].data; /* Source rectangle start address (left/top)*/ @@ -207,12 +223,24 @@ static size_t vnc_copy32(FAR struct vnc_session_s *session, /* Transfer each row from the source buffer into the update buffer */ + bigendian = session->bigendian; for (y = 0; y < height; y++) { src = srcleft; for (x = 0; x < width; x++) { - *dest++ = convert(*src); + pixel = convert(*src); + + if (bigendian) + { + rfb_putbe32(dest, pixel); + } + else + { + rfb_putle32(dest, pixel); + } + + dest += sizeof(uint32_t); src++; } diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index f17dd752552..7ed5317c2b9 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -253,6 +253,7 @@ struct vnc_session_s uint8_t display; /* Display number (for debug) */ volatile uint8_t colorfmt; /* Remote color format (See include/nuttx/fb.h) */ volatile uint8_t bpp; /* Remote bits per pixel */ + volatile bool bigendian; /* Remote expect data in big-endian format */ volatile bool rre; /* Remote supports RRE encoding */ FAR uint8_t *fb; /* Allocated local frame buffer */ diff --git a/include/nuttx/video/rfb.h b/include/nuttx/video/rfb.h index 73f5477611d..a8f68c45eb5 100644 --- a/include/nuttx/video/rfb.h +++ b/include/nuttx/video/rfb.h @@ -1131,6 +1131,48 @@ struct rfb_palettendx_s ((uint32_t)((s)[2]) << 8) | \ (uint32_t)((s)[3])) +/* There are also cases where the client may request pixel data in its + * little-endian format. + */ + +/* void rfb_putle16(FAR uint8_t *dest, uint16_t value) */ + +#define rfb_putle16(d,v) \ + do \ + { \ + register FAR uint8_t *__d = (FAR uint8_t *)(d); \ + *__d++ = ((uint16_t)(v) & 0xff); \ + *__d = ((uint16_t)(v) >> 8); \ + } \ + while (0) + +/* uin16_t rfb_getle16(FAR const uint8_t *src) */ + +#define rfb_getle16(s) \ + (((uint16_t)((s)[1]) << 8) | \ + (uint16_t)((s)[0])) + +/* void rfb_putle32(FAR uint8_t *dest, uint32_t value) */ + +#define rfb_putle32(d,v) \ + do \ + { \ + register FAR uint8_t *__d = (FAR uint8_t *)(d); \ + *__d++ = ((uint32_t)(v) & 0xff); \ + *__d++ = ((uint32_t)(v) >> 8) & 0xff; \ + *__d++ = ((uint32_t)(v) >> 16) & 0xff; \ + *__d = ((uint32_t)(v) >> 24); \ + } \ + while (0) + +/* uint32_t rfb_getle32(FAR const uint8_t *src) */ + +#define rfb_getle32(s) \ + (((uint32_t)((s)[3]) << 24) | \ + ((uint32_t)((s)[2]) << 16) | \ + ((uint32_t)((s)[1]) << 8) | \ + (uint32_t)((s)[0])) + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ From 05f720f83855f82d128e1d6f5b9ec296af061a31 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 12:38:36 -0600 Subject: [PATCH 05/22] VNC: Flush the update queue whenever the client asks for a whole screen update --- graphics/vnc/server/vnc_server.h | 2 + graphics/vnc/server/vnc_updater.c | 86 +++++++++++++++++++------------ 2 files changed, 56 insertions(+), 32 deletions(-) diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index 7ed5317c2b9..4929cc35aa7 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -233,6 +233,7 @@ enum vnc_server_e struct vnc_fbupdate_s { FAR struct vnc_fbupdate_s *flink; + bool whupd; /* True: whole screen update */ struct nxgl_rect_s rect; /* The enqueued update rectangle */ }; @@ -247,6 +248,7 @@ struct vnc_session_s struct socket listen; /* Listen socket */ struct socket connect; /* Connected socket */ volatile uint8_t state; /* See enum vnc_server_e */ + volatile uint8_t nwhupd; /* Number of whole screen updates queued */ /* Display geometry and color characteristics */ diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index d41107f15c7..eb76c990643 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -253,11 +253,18 @@ vnc_remove_queue(FAR struct vnc_session_s *session) /* It is reserved.. go get it */ rect = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updqueue); + DEBUGASSERT(rect != NULL); + + /* Check if we just removed the whole screen update from the queue */ + + if (session->nwhupd > 0 && rect->whupd) + { + session->nwhupd--; + updvdbg("Whole screen update: nwhupd=%d\n", session->nwhupd); + } vnc_sem_debug(session, "After remove", 0); sched_unlock(); - - DEBUGASSERT(rect != NULL); return rect; } @@ -486,6 +493,7 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, { FAR struct vnc_fbupdate_s *update; struct nxgl_rect_s intersection; + bool whupd; /* Clip rectangle to the screen dimensions */ @@ -499,44 +507,58 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, * of these (especially when it is confused) */ + whupd = (memcmp(&intersection, &g_wholescreen, + sizeof(struct nxgl_rect_s)) == 0); + + /* Ignore all updates if there is a queue whole screen update */ + sched_lock(); - if (memcmp(&intersection, &g_wholescreen, sizeof(struct nxgl_rect_s)) == 0) + if (session->nwhupd == 0) { - FAR struct vnc_fbupdate_s *curr; - FAR struct vnc_fbupdate_s *next; + /* Is this a new whole screen update */ - /* Yes.. discard all of the previously queued updates */ - - updvdbg("Whole screen update...\n"); - - curr = (FAR struct vnc_fbupdate_s *)session->updqueue.head; - sq_init(&session->updqueue); - sem_reset(&session->queuesem, 0); - - for (; curr != NULL; curr = next) + if (whupd) { - next = curr->flink; - vnc_free_update(session, curr); + FAR struct vnc_fbupdate_s *curr; + FAR struct vnc_fbupdate_s *next; + + /* Yes.. discard all of the previously queued updates */ + + updvdbg("New whole screen update...\n"); + + curr = (FAR struct vnc_fbupdate_s *)session->updqueue.head; + sq_init(&session->updqueue); + sem_reset(&session->queuesem, 0); + + for (; curr != NULL; curr = next) + { + next = curr->flink; + vnc_free_update(session, curr); + } + + session->nwhupd = 1; } + + /* Allocate an update structure... waiting if necessary */ + + update = vnc_alloc_update(session); + DEBUGASSERT(update != NULL); + + /* Copy the clipped rectangle into the update structure */ + + update->whupd = whupd; + nxgl_rectcopy(&update->rect, &intersection); + + /* Add the upate to the end of the update queue. */ + + vnc_add_queue(session, update); + + updvdbg("Queued {(%d, %d),(%d, %d)}\n", + intersection.pt1.x, intersection.pt1.y, + intersection.pt2.x, intersection.pt2.y); } - /* Allocate an update structure... waiting if necessary */ - - update = vnc_alloc_update(session); - DEBUGASSERT(update != NULL); - - /* Copy the clipped rectangle into the update structure */ - - nxgl_rectcopy(&update->rect, &intersection); - - /* Add the upate to the end of the update queue. */ - - vnc_add_queue(session, update); sched_unlock(); - - updvdbg("Queued {(%d, %d),(%d, %d)}\n", - intersection.pt1.x, intersection.pt1.y, - intersection.pt2.x, intersection.pt2.y); } /* Since we ignore bad rectangles and wait for updata structures, there is From c25a9b48337dfc3310695952f8bcc1e4073ec5c7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 13:19:15 -0600 Subject: [PATCH 06/22] Update a configuration --- configs/samv71-xult/vnc/defconfig | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/configs/samv71-xult/vnc/defconfig b/configs/samv71-xult/vnc/defconfig index 4399be73270..6e8a28c4b05 100644 --- a/configs/samv71-xult/vnc/defconfig +++ b/configs/samv71-xult/vnc/defconfig @@ -908,13 +908,14 @@ CONFIG_NX_UPDATE=y # # Supported Pixel Depths # -# CONFIG_NX_DISABLE_1BPP is not set -# CONFIG_NX_DISABLE_2BPP is not set -# CONFIG_NX_DISABLE_4BPP is not set -# CONFIG_NX_DISABLE_8BPP is not set +CONFIG_NX_DISABLE_1BPP=y +CONFIG_NX_DISABLE_2BPP=y +CONFIG_NX_DISABLE_4BPP=y +CONFIG_NX_DISABLE_8BPP=y # CONFIG_NX_DISABLE_16BPP is not set -# CONFIG_NX_DISABLE_24BPP is not set +CONFIG_NX_DISABLE_24BPP=y CONFIG_NX_DISABLE_32BPP=y +CONFIG_NX_PACKEDMSFIRST=y # # Input Devices @@ -988,10 +989,12 @@ CONFIG_VNCSERVER=y # CONFIG_VNCSERVER_PROTO3p3 is not set CONFIG_VNCSERVER_PROTO3p8=y CONFIG_VNCSERVER_NDISPLAYS=1 +CONFIG_VNCSERVER_NAME="NuttX" CONFIG_VNCSERVER_PRIO=100 CONFIG_VNCSERVER_STACKSIZE=2048 CONFIG_VNCSERVER_UPDATER_PRIO=100 CONFIG_VNCSERVER_UPDATER_STACKSIZE=2048 +# CONFIG_VNCSERVER_COLORFMT_RGB8 is not set CONFIG_VNCSERVER_COLORFMT_RGB16=y # CONFIG_VNCSERVER_COLORFMT_RGB32 is not set CONFIG_VNCSERVER_SCREENWIDTH=320 From 1e7b8b80ac8269ddc953e15283b30dcb4d91915c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 14:52:25 -0600 Subject: [PATCH 07/22] Add a mechanism to get remote keyboard and mouse inputs --- graphics/vnc/server/Kconfig | 2 +- graphics/vnc/server/vnc_fbdev.c | 308 ++++++++++++++++++++++++----- graphics/vnc/server/vnc_keymap.c | 30 ++- graphics/vnc/server/vnc_receiver.c | 14 +- graphics/vnc/server/vnc_server.c | 41 +--- graphics/vnc/server/vnc_server.h | 32 +-- include/nuttx/video/vnc.h | 137 +++++++++++++ 7 files changed, 432 insertions(+), 132 deletions(-) create mode 100644 include/nuttx/video/vnc.h diff --git a/graphics/vnc/server/Kconfig b/graphics/vnc/server/Kconfig index 17a5e3d8ab5..3f14b38bc2d 100644 --- a/graphics/vnc/server/Kconfig +++ b/graphics/vnc/server/Kconfig @@ -118,7 +118,7 @@ config VNCSERVER_UPDATE_BUFSIZE config VNCSERVER_KBDENCODE bool "Encode keyboard input" default n - depends on NXTERM_NXKBDIN + depends on LIB_KBDCODEC ---help--- Use a special encoding of keyboard characters as defined in include/nuttx/input/kbd_coded.h. diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index 87fb91b84d8..2f98fab21bd 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -48,6 +48,7 @@ #include #include #include +#include #include "vnc_server.h" @@ -158,7 +159,9 @@ static int up_getvideoinfo(FAR struct fb_vtable_s *vtable, DEBUGASSERT(fbinfo != NULL && vinfo != NULL); if (fbinfo != NULL && vinfo != NULL) { - session = vnc_find_session(fbinfo->display); + DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[fbinfo->display]; + if (session == NULL || session->state != VNCSERVER_RUNNING) { gdbg("ERROR: session is not connected\n"); @@ -197,7 +200,9 @@ static int up_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno, DEBUGASSERT(fbinfo != NULL && pinfo != NULL && planeno == 0); if (fbinfo != NULL && pinfo != NULL && planeno == 0) { - session = vnc_find_session(fbinfo->display); + DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[fbinfo->display]; + if (session == NULL || session->state != VNCSERVER_RUNNING) { gdbg("ERROR: session is not connected\n"); @@ -242,7 +247,9 @@ static int up_getcmap(FAR struct fb_vtable_s *vtable, if (fbinfo != NULL && cmap != NULL) { - session = vnc_find_session(fbinfo->display); + DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[fbinfo->display]; + if (session == NULL || session->state != VNCSERVER_RUNNING) { gdbg("ERROR: session is not connected\n"); @@ -277,7 +284,9 @@ static int up_putcmap(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s if (fbinfo != NULL && cmap != NULL) { - session = vnc_find_session(fbinfo->display); + DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[fbinfo->display]; + if (session == NULL || session->state != VNCSERVER_RUNNING) { gdbg("ERROR: session is not connected\n"); @@ -313,7 +322,9 @@ static int up_getcursor(FAR struct fb_vtable_s *vtable, if (fbinfo != NULL && attrib != NULL) { - session = vnc_find_session(fbinfo->display); + DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[fbinfo->display]; + if (session == NULL || session->state != VNCSERVER_RUNNING) { gdbg("ERROR: session is not connected\n"); @@ -347,7 +358,9 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, if (fbinfo != NULL && settings != NULL) { - session = vnc_find_session(fbinfo->display); + DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[fbinfo->display]; + if (session == NULL || session->state != VNCSERVER_RUNNING) { gdbg("ERROR: session is not connected\n"); @@ -381,7 +394,121 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, #endif /**************************************************************************** - * Name: vnc_wait_server + * Name: vnc_start_server + * + * Description: + * Start the VNC server. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. + * + ****************************************************************************/ + +static int vnc_start_server(int display) +{ + FAR char *argv[2]; + char str[8]; + pid_t pid; + + DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS); + + /* Check if the server is already running */ + + if (g_vnc_sessions[display] != NULL) + { + DEBUGASSERT(g_vnc_sessions[display]->state >= VNCSERVER_INITIALIZED); + return OK; + } + + /* Start the VNC server kernel thread. */ + + gvdbg("Starting the VNC server for display %d\n", display); + + g_fbstartup[display].result = -EBUSY; + sem_reset(&g_fbstartup[display].fbinit, 0); + sem_reset(&g_fbstartup[display].fbconnect, 0); + + /* Format the kernel thread arguments (ASCII.. yech) */ + + (void)itoa(display, str, 10); + argv[0] = str; + argv[1] = NULL; + + pid = kernel_thread("vnc_server", CONFIG_VNCSERVER_PRIO, + CONFIG_VNCSERVER_STACKSIZE, + (main_t)vnc_server, argv); + if (pid < 0) + { + gdbg("ERROR: Failed to start the VNC server: %d\n", (int)pid); + return (int)pid; + } + + return OK; +} + +/**************************************************************************** + * Name: vnc_wait_start + * + * Description: + * Wait for the server to be started. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. + * + ****************************************************************************/ + +static inline int vnc_wait_start(int display) +{ + int errcode; + + /* Check if there has been a session allocated yet. This is one of the + * first things that the VNC server will do with the kernel thread is + * started. But we might be here before the thread has gotten that far. + * + * If it has been allocated, then wait until it is in the INIITIALIZED + * state. The INITIAILIZED states indicates tht the session structure + * has been allocated and fully initialized. + */ + + while (g_vnc_sessions[display] == NULL || + g_vnc_sessions[display]->state != VNCSERVER_UNINITIALIZED) + { + /* The server is not yet running. Wait for the server to post the FB + * semaphore. In certain error situations, the server may post the + * semaphore, then reset it to zero. There are are certainly race + * conditions here, but I think none that are fatal. + */ + + while (sem_wait(&g_fbstartup[display].fbinit) < 0) + { + errcode = get_errno(); + + /* sem_wait() should fail only if it is interrupt by a signal. */ + + DEBUGASSERT(errcode == EINTR); + if (errcode != EINTR) + { + DEBUGASSERT(errcode > 0); + return -errcode; + } + } + } + + return OK; +} + +/**************************************************************************** + * Name: vnc_wait_connect * * Description: * Wait for the server to be connected to the VNC client. We can do @@ -397,7 +524,7 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, * ****************************************************************************/ -static inline int vnc_wait_server(int display) +static inline int vnc_wait_connect(int display) { int errcode; int result; @@ -423,7 +550,7 @@ static inline int vnc_wait_server(int display) * conditions here, but I think none that are fatal. */ - while (sem_wait(&g_fbstartup[display].fbsem) < 0) + while (sem_wait(&g_fbstartup[display].fbconnect) < 0) { errcode = get_errno(); @@ -486,48 +613,119 @@ static inline int vnc_wait_server(int display) int up_fbinitialize(int display) { - FAR char *argv[2]; - char str[8]; - pid_t pid; + int ret; - /* Start the VNC server kernel thread. - * REVISIT: There is no protection for the case where this function is - * called more that once. - */ - - gvdbg("Starting the VNC server for display %d\n", display); DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS); - /* Check if the server is already running */ + /* Start the VNC server kernel thread. */ - g_fbstartup[display].result = -EBUSY; - sem_reset(&g_fbstartup[display].fbsem, 0); - - if (g_vnc_sessions[display] != NULL) + ret = vnc_start_server(display); + if (ret < 0) { - DEBUGASSERT(g_vnc_sessions[display]->state >= VNCSERVER_INITIALIZED); - } - else - { - /* Format the kernel thread arguments (ASCII.. yech) */ - - (void)itoa(display, str, 10); - argv[0] = str; - argv[1] = NULL; - - pid = kernel_thread("vnc_server", CONFIG_VNCSERVER_PRIO, - CONFIG_VNCSERVER_STACKSIZE, - (main_t)vnc_server, argv); - if (pid < 0) - { - gdbg("ERROR: Failed to start the VNC server: %d\n", (int)pid); - return (int)pid; - } + gvdbg("ERROR: vnc_start_server() failed: %d\n", ret); + return ret; } /* Wait for the VNC client to connect and for the RFB to be ready */ - return vnc_wait_server(display); + ret = vnc_wait_connect(display); + if (ret < 0) + { + gvdbg("ERROR: vnc_wait_connect() failed: %d\n", ret); + } + + return ret; +} + +/**************************************************************************** + * Function: vnc_fbinitialize + * + * Description: + * Initialize the VNC frame buffer driver. The VNC frame buffer driver + * supports two initialization interfaces: The standard up_fbinitialize() + * that will be called from the graphics layer and this speical + * initialization function that can be used only by VNC aware OS logic. + * + * The two initialization functions may be called separated or together in + * either order. The difference is that standard up_fbinitialize(), if + * used by itself, will not have any remote mouse or keyboard inputs that + * are reported to the VNC framebuffer driver from the remote VNC client. + * + * In the standard graphics architecture, the keyboard/mouse inputs are + * received by some appliation/board specific logic at the highest level + * in the architecture via input drivers. The received keyboard/mouse + * input data must then be "injected" into NX where it can they can be + * assigned to the window that has focus. They will eventually be + * received by the Window instances via NX callback methods. + * + * NX is a middleware layer in the architecture, below the + * application/board specific logic but above the driver level logic. The + * frame buffer driver, on the other hand lies at the very lowest level in + * the graphics architecture. It cannot call upward into the application + * nor can it call upward into NX. So, some other logic. + * + * vnc_fbinitialize() provides an optional, alternative initialization + * function. It is optional becuase it need not be called. If it is not + * called, however, keyboard/mouse inputs from the remote VNC client will + * be lost. By calling vnc_fbinitialize(), you can provide callout + * functions that can be received by logic higher in the architure. This + * higher level level callouts can then call nx_kbdin() or nx_mousein() on + * behalf of the VNC server. + * + * Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * kbdout - If non-NULL, then the pointed-to function will be called to + * handle all keyboard input as it is received. This may be either raw, + * ASCII keypress input or encoded keyboard input as determined by + * CONFIG_VNCSERVER_KBDENCODE. See include/nuttx/input/kbd_codec.h. + * mouseout - If non-NULL, then the pointed-to function will be called to + * handle all mouse input as it is received. + * arg - An opaque user provided argument that will be provided when the + * callouts are performed. + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +int vnc_fbinitialize(int display, vnc_kbdout_t kbdout, + vnc_mouseout_t mouseout, FAR void *arg) +{ + FAR struct vnc_session_s *session; + int ret; + + DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS); + + /* Start the VNC server kernel thread. */ + + ret = vnc_start_server(display); + if (ret < 0) + { + gvdbg("ERROR: vnc_start_server() failed: %d\n", ret); + return ret; + } + + /* Wait for the VNC server to start and complete initialization. */ + + ret = vnc_wait_start(display); + if (ret < 0) + { + gvdbg("ERROR: vnc_wait_start() failed: %d\n", ret); + return ret; + } + + /* Save the input callout function information in the session structure. */ + + session = g_vnc_sessions[display]; + DEBUGASSERT(session != NULL); + + session->kbdout = kbdout; + session->mouseout = mouseout; + session->arg = arg; + + return OK; } /**************************************************************************** @@ -550,12 +748,15 @@ int up_fbinitialize(int display) FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) { - FAR struct vnc_session_s *session = vnc_find_session(display); + FAR struct vnc_session_s *session; FAR struct vnc_fbinfo_s *fbinfo; + DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[display]; + /* Verify that the session is still valid */ - if (session->state != VNCSERVER_RUNNING) + if (session == NULL || session->state != VNCSERVER_RUNNING) { return NULL; } @@ -607,14 +808,21 @@ FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) void up_fbuninitialize(int display) { #if 0 /* Do nothing */ - FAR struct vnc_session_s *session = vnc_find_session(display); + FAR struct vnc_session_s *session; FAR struct vnc_fbinfo_s *fbinfo; - DEBUGASSERT(session != NULL); - fbinfo = &g_fbinfo[display]; + DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS); + session = g_vnc_sessions[display]; + + /* Verify that the session is still valid */ + + if (session != NULL) + { + fbinfo = &g_fbinfo[display]; #warning Missing logic - UNUSED(session); - UNUSED(fbinfo); + UNUSED(session); + UNUSED(fbinfo); + } #endif } @@ -653,7 +861,7 @@ void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo, */ DEBUGASSERT(pinfo->display >= 0 && pinfo->display < RFB_MAX_DISPLAYS); - session = vnc_find_session(pinfo->display); + session = g_vnc_sessions[pinfo->display]; /* Verify that the session is still valid */ diff --git a/graphics/vnc/server/vnc_keymap.c b/graphics/vnc/server/vnc_keymap.c index 57690183f46..bb5fe3f6233 100644 --- a/graphics/vnc/server/vnc_keymap.c +++ b/graphics/vnc/server/vnc_keymap.c @@ -481,9 +481,10 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, #ifdef CONFIG_VNCSERVER_KBDENCODE uint8_t buffer[4] int nch; +#else + uint8_t buffer; #endif int16_t keych; - int ret; /* Check for modifier keys */ @@ -505,6 +506,14 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, } #endif + /* If no external keyboard input handler has been provided, then we have to drop the keyboard input. + */ + + if (session->kbdout == NULL) + { + return; + } + /* Try to convert the keycode to an ASCII value */ keych = vnc_kbd_ascii((char)(keysym & 255)); @@ -580,19 +589,12 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, /* Inject the normal character sequence into NX */ - ret = nx_kbdin(session->handle, nch, buffer); - if (ret < 0) - { - gdbg("ERROR: nx_kbdin() failed: %d\n", ret); - } + session->kbdout(session->arg, nch, buffer); #else /* Inject the single key press into NX */ - ret = nx_kbdchin(session->handle,(uint8_t)keych); - if (ret < 0) - { - gdbg("ERROR: nx_kbdchin() failed: %d\n", ret); - } + buffer = (uint8_t)keych; + session->kbdout(session->arg, 1, &buffer); #endif } @@ -619,11 +621,7 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, /* Inject the special character sequence into NX */ - ret = nx_kbdin(session->handle, nch, buffer); - if (ret < 0) - { - gdbg("ERROR: nx_kbdin() failed: %d\n", ret) - } + session->kbdout(session->arg, nch, buffer); } } #endif diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 1df8df72d27..862b39362ae 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -337,7 +337,7 @@ int vnc_receiver(FAR struct vnc_session_s *session) #ifdef CONFIG_NX_XYINPUT /* REVISIT: How will be get the NX handle? */ - else if (session->handle != NULL) + else if (session->mouseout != NULL) { event = (FAR struct rfb_pointerevent_s *)session->inbuf; @@ -362,14 +362,10 @@ int vnc_receiver(FAR struct vnc_session_s *session) buttons |= NX_MOUSE_RIGHTBUTTON; } - ret = nx_mousein(session->handle, - (nxgl_coord_t)rfb_getbe16(event->xpos), - (nxgl_coord_t)rfb_getbe16(event->ypos), - buttons); - if (ret < 0) - { - gdbg("ERROR: nx_mousein failed: %d\n", ret); - } + session->mouseout(session->arg, + (nxgl_coord_t)rfb_getbe16(event->xpos), + (nxgl_coord_t)rfb_getbe16(event->ypos), + buttons); } #endif } diff --git a/graphics/vnc/server/vnc_server.c b/graphics/vnc/server/vnc_server.c index 742a97fa014..c33050f3032 100644 --- a/graphics/vnc/server/vnc_server.c +++ b/graphics/vnc/server/vnc_server.c @@ -271,6 +271,11 @@ int vnc_server(int argc, FAR char *argv[]) sem_init(&session->freesem, 0, CONFIG_VNCSERVER_NUPDATES); sem_init(&session->queuesem, 0, 0); + /* Inform any waiter that we have started */ + + vnc_reset_session(session, fb, display); + sem_post(&g_fbstartup[display].fbinit); + /* Loop... handling each each VNC client connection to this display. Only * a single client is allowed for each display. */ @@ -283,7 +288,7 @@ int vnc_server(int argc, FAR char *argv[]) vnc_reset_session(session, fb, display); g_fbstartup[display].result = -EBUSY; - sem_reset(&g_fbstartup[display].fbsem, 0); + sem_reset(&g_fbstartup[display].fbconnect, 0); /* Establish a connection with the VNC client */ @@ -321,7 +326,7 @@ int vnc_server(int argc, FAR char *argv[]) */ g_fbstartup[display].result = OK; - sem_post(&g_fbstartup[display].fbsem); + sem_post(&g_fbstartup[display].fbconnect); /* Run the VNC receiver on this trhead. The VNC receiver handles * all Client-to-Server messages. The VNC receiver function does @@ -347,36 +352,6 @@ errout_with_fb: errout_with_post: g_fbstartup[display].result = ret; - sem_post(&g_fbstartup[display].fbsem); + sem_post(&g_fbstartup[display].fbconnect); return EXIT_FAILURE; } - -/**************************************************************************** - * Name: vnc_find_session - * - * Description: - * Return the session structure associated with this display. - * - * Input Parameters: - * display - The display number of interest. - * - * Returned Value: - * Returns the instance of the session structure for this display. NULL - * will be returned if the server has not yet been started or if the - * display number is out of range. - * - ****************************************************************************/ - -FAR struct vnc_session_s *vnc_find_session(int display) -{ - FAR struct vnc_session_s *session = NULL; - - DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS); - - if (display >= 0 && display < RFB_MAX_DISPLAYS) - { - session = g_vnc_sessions[display]; - } - - return session; -} diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index 4929cc35aa7..077bc0d6b44 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -49,6 +49,7 @@ #include #include +#include #include #include #include @@ -239,10 +240,6 @@ struct vnc_fbupdate_s struct vnc_session_s { - /* NX graphics system */ - - NXHANDLE handle; /* NX graphics handle */ - /* Connection data */ struct socket listen; /* Listen socket */ @@ -259,6 +256,12 @@ struct vnc_session_s volatile bool rre; /* Remote supports RRE encoding */ FAR uint8_t *fb; /* Allocated local frame buffer */ + /* VNC client input support */ + + vnc_kbdout_t kbdout; /* Callout when keyboard input is received */ + vnc_mouseout_t mouseout; /* Callout when keyboard input is received */ + FAR void *arg; /* Argument that accompanies the callouts */ + /* Updater information */ pthread_t updater; /* Updater thread ID */ @@ -283,7 +286,8 @@ struct vnc_session_s struct fb_startup_s { - sem_t fbsem; /* Framebuffer driver will wait on this */ + sem_t fbinit; /* Wait for session creation */ + sem_t fbconnect; /* Wait for client connection */ int16_t result; /* OK: successfully initialized */ }; @@ -537,24 +541,6 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, bool keydown); #endif -/**************************************************************************** - * Name: vnc_find_session - * - * Description: - * Return the session structure associated with this display. - * - * Input Parameters: - * display - The display number of interest. - * - * Returned Value: - * Returns the instance of the session structure for this display. NULL - * will be returned if the server has not yet been started or if the - * display number is out of range. - * - ****************************************************************************/ - -FAR struct vnc_session_s *vnc_find_session(int display); - /**************************************************************************** * Name: vnc_convert_rgbNN * diff --git a/include/nuttx/video/vnc.h b/include/nuttx/video/vnc.h new file mode 100644 index 00000000000..a3b9f9e675f --- /dev/null +++ b/include/nuttx/video/vnc.h @@ -0,0 +1,137 @@ +/**************************************************************************** + * include/nuttx/video/vnc.h + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_VIDEO_VNC_H +#define __INCLUDE_NUTTX_VIDEO_VNC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* These are the types of the function pointers used to support callouts when + * mouse or keyboard inputs are received by the local VNC server from the + * remove VNC client. Notice that these callouts have arguments that match + * the inputs to nx_kbdin() and nx_mousein(). + */ + +typedef CODE void (*vnc_mouseout_t)(FAR void *arg, nxgl_coord_t x, + nxgl_coord_t y, uint8_t buttons); +typedef CODE void (*vnc_kbdout_t)(FAR void *arg, uint8_t nch, + FAR const uint8_t *ch); + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Function: vnc_fbinitialize + * + * Description: + * Initialize the VNC frame buffer driver. The VNC frame buffer driver + * supports two initialization interfaces: The standard up_fbinitialize() + * that will be called from the graphics layer and this speical + * initialization function that can be used only by VNC aware OS logic. + * + * The two initialization functions may be called separated or together in + * either order. The difference is that standard up_fbinitialize(), if + * used by itself, will not have any remote mouse or keyboard inputs that + * are reported to the VNC framebuffer driver from the remote VNC client. + * + * In the standard graphics architecture, the keyboard/mouse inputs are + * received by some appliation/board specific logic at the highest level + * in the architecture via input drivers. The received keyboard/mouse + * input data must then be "injected" into NX where it can they can be + * assigned to the window that has focus. They will eventually be + * received by the Window instances via NX callback methods. + * + * NX is a middleware layer in the architecture, below the + * application/board specific logic but above the driver level logic. The + * frame buffer driver, on the other hand lies at the very lowest level in + * the graphics architecture. It cannot call upward into the application + * nor can it call upward into NX. So, some other logic. + * + * vnc_fbinitialize() provides an optional, alternative initialization + * function. It is optional becuase it need not be called. If it is not + * called, however, keyboard/mouse inputs from the remote VNC client will + * be lost. By calling vnc_fbinitialize(), you can provide callout + * functions that can be received by logic higher in the architure. This + * higher level level callouts can then call nx_kbdin() or nx_mousein() on + * behalf of the VNC server. + * + * Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * kbdout - If non-NULL, then the pointed-to function will be called to + * handle all keyboard input as it is received. This may be either raw, + * ASCII keypress input or encoded keyboard input as determined by + * CONFIG_VNCSERVER_KBDENCODE. See include/nuttx/input/kbd_codec.h. + * mouseout - If non-NULL, then the pointed-to function will be called to + * handle all mouse input as it is received. + * arg - An opaque user provided argument that will be provided when the + * callouts are performed. + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +int vnc_fbinitialize(int display, vnc_kbdout_t kbdout, + vnc_mouseout_t mouseout, FAR void *arg); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_NUTTX_VIDEO_VNC_H */ From ceac1dcaeedc86a5381f3e252eba201152a297db Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Apr 2016 16:15:56 -0600 Subject: [PATCH 08/22] Update README --- configs/samv71-xult/README.txt | 12 +++++++++++- configs/samv71-xult/vnc/defconfig | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 0ada8ad0109..39d46eb0f28 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -2328,7 +2328,7 @@ Configuration sub-directories size of update messages. That is 1024 bytes in that configuration (the full message with the header will be a little larger). The MTU (CONFIG_NET_ETH_MTU) is set to 590 so that a full update will - require several packets.i + require several packets. Write buffering also effects network performance. This will break up the large updates into small (196 byte) groups. When we run out @@ -2339,3 +2339,13 @@ Configuration sub-directories mouse/keyboard inputs in the options/input menu. That will make things a little clearer. + STATUS: + 2016-04-21: I have gottent he apps/examples/nximage to work + with lots issues with GRAPHICS and UPDATER debug ON. There + are reliability problems and it hangs at the end of the test. + If I turn UPDATE debug off (only), then the display output is + corrupted and I get a hardfault. + + Mostly likely, the UPDATER debug output slows the updates and + avoids some kind of race condition with the networking. Oddly, + it does not work at all if I turn off TCP write buffering. diff --git a/configs/samv71-xult/vnc/defconfig b/configs/samv71-xult/vnc/defconfig index 6e8a28c4b05..945e47f4f8a 100644 --- a/configs/samv71-xult/vnc/defconfig +++ b/configs/samv71-xult/vnc/defconfig @@ -832,7 +832,7 @@ CONFIG_NET_IOB=y CONFIG_IOB_NBUFFERS=72 CONFIG_IOB_BUFSIZE=196 CONFIG_IOB_NCHAINS=8 -CONFIG_IOB_THROTTLE=8 +CONFIG_IOB_THROTTLE=32 # CONFIG_NET_ARCH_INCR32 is not set # CONFIG_NET_ARCH_CHKSUM is not set CONFIG_NET_STATISTICS=y From fd794111adc31281fd8dfe1c70547fdac5f51f50 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 21 Apr 2016 16:45:32 -1000 Subject: [PATCH 09/22] Fixed const warning --- include/nuttx/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nuttx/board.h b/include/nuttx/board.h index 0d742257e3c..edc23385dc0 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -680,7 +680,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler); ****************************************************************************/ #ifdef CONFIG_BOARD_CRASHDUMP -void board_crashdump(uint32_t currentsp, void *tcb, uint8_t *filename, +void board_crashdump(uint32_t currentsp, void *tcb, const uint8_t *filename, int lineno); #endif From 8b36a83df18d08eae212624307e26be495a663ec Mon Sep 17 00:00:00 2001 From: Marco Krahl Date: Fri, 22 Apr 2016 07:27:00 -0600 Subject: [PATCH 10/22] stm32: fix wrong FSCM pin mapping for stm32f42x --- arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h b/arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h index 02664a0ba90..d8fbe7346cc 100644 --- a/arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h +++ b/arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h @@ -329,11 +329,21 @@ # define GPIO_FSMC_NCE4_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN11) # define GPIO_FSMC_NIORD (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN6) # define GPIO_FSMC_NIOWR (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN8) +# define GPIO_FSMC_SDCKE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTH|GPIO_PIN2) +# define GPIO_FSMC_SDCKE0_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN3) +# define GPIO_FSMC_SDNE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTH|GPIO_PIN3) +# define GPIO_FSMC_SDNE0_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN2) +# define GPIO_FSMC_SDNWE_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN0) +# define GPIO_FSMC_SDNWE_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTH|GPIO_PIN5) +# define GPIO_FSMC_SDNRAS (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN11) +# define GPIO_FSMC_SDCLK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN8) +# define GPIO_FSMC_SDNCAS (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN15) +# define GPIO_FSMC_BA0 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN4) +# define GPIO_FSMC_BA1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTG|GPIO_PIN5) # define GPIO_FSMC_NREG (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTF|GPIO_PIN7) #endif -#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429) || \ - defined(CONFIG_STM32_STM32F446) || defined(CONFIG_STM32_STM32F469) +#if defined(CONFIG_STM32_STM32F446) || defined(CONFIG_STM32_STM32F469) # define GPIO_FSMC_SDCKE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN3) # define GPIO_FSMC_SDCKE0_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN5) # define GPIO_FSMC_SDNE0_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_100MHz|GPIO_PORTC|GPIO_PIN2) From 3537f93cfb668d757864ef8046739ad1ec944074 Mon Sep 17 00:00:00 2001 From: Marco Krahl Date: Fri, 22 Apr 2016 07:28:21 -0600 Subject: [PATCH 11/22] stm32f429i-disco: Set default spi clock frequency for display initializing --- configs/stm32f429i-disco/src/stm32_ili93414ws.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/stm32f429i-disco/src/stm32_ili93414ws.c b/configs/stm32f429i-disco/src/stm32_ili93414ws.c index aea55ea8d63..58dad6eae23 100644 --- a/configs/stm32f429i-disco/src/stm32_ili93414ws.c +++ b/configs/stm32f429i-disco/src/stm32_ili93414ws.c @@ -69,6 +69,10 @@ /* spi frequency based on arch/arm/src/stm32/stm32_spi.c */ +#ifndef CONFIG_STM32F429I_DISCO_ILI9341_SPIFREQUENCY +# define CONFIG_STM32F429I_DISCO_ILI9341_SPIFREQUENCY 20000000 +#endif + #if CONFIG_STM32F429I_DISCO_ILI9341_SPIFREQUENCY >= \ (STM32_PCLK1_FREQUENCY >> 1) # define ILI93414WS_SPI_BR SPI_CR1_FPCLCKd2 /* 000: fPCLK/2 */ From 57449d9c8f1bfdbc93feb0c210ccecd2da7c09b5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Apr 2016 07:29:44 -0600 Subject: [PATCH 12/22] Updte changelog --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index ed8dd467b11..3686531d89d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11665,4 +11665,11 @@ complete, but untested and so not ready for primetime (2016-04-18). * configs/samv71-xult/vnc: Add a configuration that will be used to verify VNC (also untested) (2016-04-18). + * drivers/ioexpander: Fix an error in the PCA9555 driver: Under certain + error conditions, interrupts were not being re-enabled. Sebastien + Lorquet (2016-04-20). + * arch/arm/src/stm32 and configs/stm32f429i-disco: Correct some bad + commits that broke the LTDC display example. From Marco Krahl + (2016-04-22). + From e2f17ce7e7998d234f4df04cea1016cc14100eb2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Apr 2016 07:42:37 -0600 Subject: [PATCH 13/22] Trivial changes from review --- include/nuttx/board.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/nuttx/board.h b/include/nuttx/board.h index edc23385dc0..9e0ea70ab80 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/board.h * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,8 @@ * definitions provide the common interface between NuttX and the * architecture-specific implementation in arch/ * - * These definitions are retained in the the header file nuttx/include/arch.h + * These definitions are retained in the the header file + * nuttx/include/arch.h * * NOTE: up_ is supposed to stand for microprocessor; the u is like the * Greek letter micron: µ. So it would be µP which is a common shortening @@ -680,7 +681,8 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler); ****************************************************************************/ #ifdef CONFIG_BOARD_CRASHDUMP -void board_crashdump(uint32_t currentsp, void *tcb, const uint8_t *filename, +void board_crashdump(uintptr_t currentsp, FAR void *tcb, + FAR const uint8_t *filename, int lineno); #endif From 2a928cbdbebe64448a398730f2a522cb4b9ce7a0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Apr 2016 08:57:42 -0600 Subject: [PATCH 14/22] VNC: Verify RGB8 operation; samv71-xult: VNC configuration now uses RGB8 by defualt --- configs/samv71-xult/README.txt | 43 ++++++++++++++++++++++++++----- configs/samv71-xult/vnc/defconfig | 12 ++++----- graphics/vnc/server/vnc_color.c | 23 +++++++---------- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 39d46eb0f28..67477ec39c5 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -2320,7 +2320,7 @@ Configuration sub-directories 1. Network configuration: IP address 10.0.0.2. The is easily changed via 'make menuconfig'. The VNC server address is 10.0.0.2:5900. - 2. The default (local) framebuffer configuration is 320x240 with 16-bit + 2. The default (local) framebuffer configuration is 320x240 with 8-bit RGB color. 3. There are complicated interactions between VNC and the network @@ -2339,13 +2339,44 @@ Configuration sub-directories mouse/keyboard inputs in the options/input menu. That will make things a little clearer. + 5. To select 16-bits per pixel RGB15 5:6:5 + + CONFIG_NX_DISABLE_8BPP=y + # CONFIG_NX_DISABLE_16BPP is not set + + # CONFIG_VNCSERVER_COLORFMT_RGB8 is not set + CONFIG_VNCSERVER_COLORFMT_RGB16=y + + CONFIG_EXAMPLES_NXIMAGE_BPP=16 + + To re-select 8-bits per pixel RGB8 3:3:3 + + # CONFIG_NX_DISABLE_8BPP is not set + CONFIG_NX_DISABLE_16BPP=y + + CONFIG_VNCSERVER_COLORFMT_RGB8=y + # CONFIG_VNCSERVER_COLORFMT_RGB16 is not set + + # CONFIG_EXAMPLES_NXIMAGE_GREYSCALE is not set + CONFIG_EXAMPLES_NXIMAGE_BPP=8 + STATUS: - 2016-04-21: I have gottent he apps/examples/nximage to work - with lots issues with GRAPHICS and UPDATER debug ON. There - are reliability problems and it hangs at the end of the test. - If I turn UPDATE debug off (only), then the display output is - corrupted and I get a hardfault. + 2016-04-21: I have gotten the apps/examples/nximage to work with + lots issues with verbose GRAPHICS and UPDATER debug ON. There are + reliability problems and it hangs at the end of the test. But if + I turn UPDATE debug off (only), then the display output is + corrupted. I have also see hardfaults. Mostly likely, the UPDATER debug output slows the updates and avoids some kind of race condition with the networking. Oddly, it does not work at all if I turn off TCP write buffering. + + 2016-04-22: I added a 100 MS delay at the beginning of the + updater loop and it made no difference. This seems to eliminate + the suspected networking race condition. + + The default configuration now uses RGB8 which needs a lot less + SRAM for the local frame buffer and does not the color quality + in the remote display (since it is also 8 BPP). At 8 BPP, the + remote display is correct (although I still do see problems with + hangs). diff --git a/configs/samv71-xult/vnc/defconfig b/configs/samv71-xult/vnc/defconfig index 945e47f4f8a..087f0b0f1d1 100644 --- a/configs/samv71-xult/vnc/defconfig +++ b/configs/samv71-xult/vnc/defconfig @@ -901,7 +901,6 @@ CONFIG_FS_PROCFS=y CONFIG_NX=y CONFIG_NX_NPLANES=1 CONFIG_NX_BGCOLOR=0x0 -# CONFIG_NX_ANTIALIASING is not set # CONFIG_NX_WRITEONLY is not set CONFIG_NX_UPDATE=y @@ -911,8 +910,8 @@ CONFIG_NX_UPDATE=y CONFIG_NX_DISABLE_1BPP=y CONFIG_NX_DISABLE_2BPP=y CONFIG_NX_DISABLE_4BPP=y -CONFIG_NX_DISABLE_8BPP=y -# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_8BPP is not set +CONFIG_NX_DISABLE_16BPP=y CONFIG_NX_DISABLE_24BPP=y CONFIG_NX_DISABLE_32BPP=y CONFIG_NX_PACKEDMSFIRST=y @@ -994,8 +993,8 @@ CONFIG_VNCSERVER_PRIO=100 CONFIG_VNCSERVER_STACKSIZE=2048 CONFIG_VNCSERVER_UPDATER_PRIO=100 CONFIG_VNCSERVER_UPDATER_STACKSIZE=2048 -# CONFIG_VNCSERVER_COLORFMT_RGB8 is not set -CONFIG_VNCSERVER_COLORFMT_RGB16=y +CONFIG_VNCSERVER_COLORFMT_RGB8=y +# CONFIG_VNCSERVER_COLORFMT_RGB16 is not set # CONFIG_VNCSERVER_COLORFMT_RGB32 is not set CONFIG_VNCSERVER_SCREENWIDTH=320 CONFIG_VNCSERVER_SCREENHEIGHT=240 @@ -1129,7 +1128,8 @@ CONFIG_EXAMPLES_NSH=y CONFIG_EXAMPLES_NXIMAGE=y CONFIG_EXAMPLES_NXIMAGE_VPLANE=0 CONFIG_EXAMPLES_NXIMAGE_DEVNO=0 -CONFIG_EXAMPLES_NXIMAGE_BPP=16 +CONFIG_EXAMPLES_NXIMAGE_BPP=8 +# CONFIG_EXAMPLES_NXIMAGE_GREYSCALE is not set # CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 is not set CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0=y # CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 is not set diff --git a/graphics/vnc/server/vnc_color.c b/graphics/vnc/server/vnc_color.c index 597b9686d67..8543cf7866e 100644 --- a/graphics/vnc/server/vnc_color.c +++ b/graphics/vnc/server/vnc_color.c @@ -265,9 +265,14 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb) * Name: vnc_colors * * Description: - * Test the update rectangle to see if it contains complex colors. If it - * contains only a few colors, then it may be a candidate for some type - * run-length encoding. + * Test the update rectangle to see if it contains complex colors. If it + * contains only a few colors, then it may be a candidate for some type + * run-length encoding. + * + * REVISIT: This function is imperfect: It will fail if there are more + * than 8 colors in the region. For small colors, we can keep a local + * array for all color formats and always return the exact result, no + * matter now many colors. * * Input Parameters: * session - An instance of the session structure. @@ -280,15 +285,13 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb) * The number of valid colors in the colors[] array are returned, the * first entry being the most frequent. A negated errno value is returned * if the colors cannot be determined. This would be the case if the color - * depth is > 8 and there are more than 'maxcolors' colors in the update - * rectangle. + * there are more than 'maxcolors' colors in the update rectangle. * ****************************************************************************/ int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect, unsigned int maxcolors, FAR lfb_color_t *colors) { -#if RFB_PIXELDEPTH > 8 FAR const lfb_color_t *rowstart; FAR const lfb_color_t *pixptr; lfb_color_t pixel; @@ -412,12 +415,4 @@ int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect, /* And return the number of colors that we found */ return ncolors; - -#else - /* For small colors, we can keep a local array for all color formats and - * always return the exact result, no matter now many colors. OR we could - * just remove this conditional compilation and live with 8 colors max. - */ -# error No support for small colors -#endif } From 3527a5a5d7ac8dea2881919317d2c8b6e8798cd1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Apr 2016 10:13:53 -0600 Subject: [PATCH 15/22] Update README.txt --- configs/samv71-xult/README.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 67477ec39c5..2530d33b2eb 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -2349,7 +2349,7 @@ Configuration sub-directories CONFIG_EXAMPLES_NXIMAGE_BPP=16 - To re-select 8-bits per pixel RGB8 3:3:3 + To re-select 8-bits per pixel RGB8 3:3:2 # CONFIG_NX_DISABLE_8BPP is not set CONFIG_NX_DISABLE_16BPP=y @@ -2362,10 +2362,10 @@ Configuration sub-directories STATUS: 2016-04-21: I have gotten the apps/examples/nximage to work with - lots issues with verbose GRAPHICS and UPDATER debug ON. There are - reliability problems and it hangs at the end of the test. But if - I turn UPDATE debug off (only), then the display output is - corrupted. I have also see hardfaults. + lots issues with 16-bit RGB and verbose GRAPHICS and UPDATER debug + ON. There are reliability problems and it hangs at the end of the + test. But if I turn UPDATE debug off (only), then the display + output is corrupted. I have also see hardfaults. Mostly likely, the UPDATER debug output slows the updates and avoids some kind of race condition with the networking. Oddly, @@ -2373,10 +2373,11 @@ Configuration sub-directories 2016-04-22: I added a 100 MS delay at the beginning of the updater loop and it made no difference. This seems to eliminate - the suspected networking race condition. + the suspected networking race condition. I am thinking now + either some data overrun or VNC protocol/timing issue? The default configuration now uses RGB8 which needs a lot less - SRAM for the local frame buffer and does not the color quality - in the remote display (since it is also 8 BPP). At 8 BPP, the - remote display is correct (although I still do see problems with - hangs). + SRAM for the local frame buffer and does not degrade the color + quality in the remote display (since it is also 8 BPP). At 8 + BPP, the remote display is correct even with both GRAPHICS and + UPDATER debug OFF -- and there is no hang! From 47c2b3d4a76fc0671eb679e52d6b7621e1fabae7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Apr 2016 12:48:27 -0600 Subject: [PATCH 16/22] VNC: Add default mouse/keyboard input handlers --- graphics/vnc/server/vnc_keymap.c | 24 ++++++++++ graphics/vnc/server/vnc_receiver.c | 31 ++++++++++++ include/nuttx/video/vnc.h | 75 ++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) diff --git a/graphics/vnc/server/vnc_keymap.c b/graphics/vnc/server/vnc_keymap.c index bb5fe3f6233..b23e3199a1f 100644 --- a/graphics/vnc/server/vnc_keymap.c +++ b/graphics/vnc/server/vnc_keymap.c @@ -48,6 +48,8 @@ #define XK_LATIN1 1 #define XK_XKB_KEYS 1 +#include +#include #include #include @@ -627,4 +629,26 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, #endif } +/**************************************************************************** + * Function: vnc_kbdout + * + * Description: + * This is the default keyboard callout function. This is simply wrappers around nx_kdbout(), respectively. When configured using vnc_fbinitialize(), the 'arg' must be the correct NXHANDLE value. + * + * Parameters: + * arg - The NXHANDLE from the NX graphics subsystem + * nch - Number of characters + * ch - An array of input characters. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch) +{ + DEBUGASSERT(arg != NULL); + (void)nx_kbdin((NXHANDLE)arg, nch, ch); +} + #endif /* CONFIG_NX_KBD */ \ No newline at end of file diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 862b39362ae..08a001631b6 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -49,6 +49,9 @@ #include #include +#include +#include +#include #include "vnc_server.h" @@ -470,3 +473,31 @@ int vnc_client_encodings(FAR struct vnc_session_s *session, return OK; } + +/**************************************************************************** + * Function: vnc_mouse + * + * Description: + * This is the default keyboard/mouse callout function. This is simply a + * wrapper around nx_mousein(). When + * configured using vnc_fbinitialize(), the 'arg' must be the correct + * NXHANDLE value. + * + * Parameters: + * See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These + * callouts have arguments that match the inputs to nx_kbdin() and + * nx_mousein() (if arg is really of type NXHANDLE). + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_NX_XYINPUT +void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y, + uint8_t buttons) +{ + DEBUGASSERT(arg != NULL); + (void)nx_mousein((NXHANDLE)arg, x, y, buttons); +} +#endif diff --git a/include/nuttx/video/vnc.h b/include/nuttx/video/vnc.h index a3b9f9e675f..2dbcbd9e033 100644 --- a/include/nuttx/video/vnc.h +++ b/include/nuttx/video/vnc.h @@ -108,6 +108,8 @@ extern "C" * higher level level callouts can then call nx_kbdin() or nx_mousein() on * behalf of the VNC server. * + * See also vnc_default_fbinitialize() below. + * * Parameters: * display - In the case of hardware with multiple displays, this * specifies the display. Normally this is zero. @@ -129,6 +131,79 @@ extern "C" int vnc_fbinitialize(int display, vnc_kbdout_t kbdout, vnc_mouseout_t mouseout, FAR void *arg); +/**************************************************************************** + * Function: vnc_mouse and vnc_kbdout + * + * Description: + * These are the default keyboard/mouse callout functions. They are + * simply wrappers around nx_mousein() and nx_kdbout(), respectively. When + * configured using vnc_fbinitialize(), the 'arg' must be the correct + * NXHANDLE value. + * + * See also vnc_default_fbinitialize() below. + * + * Parameters: + * See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These + * callouts have arguments that match the inputs to nx_kbdin() and + * nx_mousein() (if arg is really of type NXHANDLE). + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch); +#endif + +#ifdef CONFIG_NX_XYINPUT +void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y, + uint8_t buttons); +#endif + +/**************************************************************************** + * Function: vnc_default_fbinitialize + * + * Description: + * This is just a wrapper around vnc_fbinitialize() that will establish + * the default mouse and keyboard callout functions. + * + * Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * handle - And instance of NXHANDLE returned from initialization of the + * NX graphics system for that display. + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +/* int vnc_default_fbinitialize(nt display, NXHANDLE handle); */ + +#if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT) + +#define vnc_default_fbinitialize(d,h) \ + vnc_fbinitialize((d), vnc_kbdout, vnc_mouseout, (FAR void *)(h)) + +#elif defined(CONFIG_NX_KBD) + +#define vnc_default_fbinitialize(d,h) \ + vnc_fbinitialize((d), vnc_kbdout, NULL, (FAR void *)(h)) + +#elif defined(CONFIG_NX_XYINPUT) + +#define vnc_default_fbinitialize(d,h) \ + vnc_fbinitialize((d), NULL, vnc_mouseout, (FAR void *)(h)) + +#else + +#define vnc_default_fbinitialize(d,h) \ + vnc_fbinitialize((d), NULL, NULL, NULL) + +#endif + #undef EXTERN #ifdef __cplusplus } From 8c1534e3eda71327cfdcc20ac5f1317eb7dff044 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 22 Apr 2016 13:39:35 -0600 Subject: [PATCH 17/22] VNC: Finish initializing the VNC server once we have the NX handle --- configs/sim/src/sim_touchscreen.c | 15 +++++++++++++++ graphics/nxmu/nx_start.c | 16 ---------------- include/nuttx/video/vnc.h | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index 5187aa411f2..c6afc355284 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -50,6 +50,10 @@ #include #include +#ifdef CONFIG_VNCSERVER +# include +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -130,6 +134,17 @@ int board_tsc_setup(int minor) goto errout_with_fb; } +#ifdef CONFIG_VNCSERVER + /* Setup the VNC server to support keyboard/mouse inputs */ + + ret = vnc_default_fbinitialize(0, g_simtc.hnx); + if (ret < 0) + { + idbg("vnc_default_fbinitialize failed: %d\n", ret); + goto errout_with_fb; + } +#endif + /* Set the background to the configured background color */ ivdbg("Set background color=%d\n", CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR); diff --git a/graphics/nxmu/nx_start.c b/graphics/nxmu/nx_start.c index 78e98132ee6..814dc5a70cf 100644 --- a/graphics/nxmu/nx_start.c +++ b/graphics/nxmu/nx_start.c @@ -53,22 +53,6 @@ #ifdef CONFIG_NX_NXSTART -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/include/nuttx/video/vnc.h b/include/nuttx/video/vnc.h index 2dbcbd9e033..fdb1dfd4a93 100644 --- a/include/nuttx/video/vnc.h +++ b/include/nuttx/video/vnc.h @@ -180,7 +180,7 @@ void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y, * ****************************************************************************/ -/* int vnc_default_fbinitialize(nt display, NXHANDLE handle); */ +/* int vnc_default_fbinitialize(int display, NXHANDLE handle); */ #if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT) From fab5a71fe585f4187014e2ea759b23960652dcbd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Apr 2016 08:21:15 -0600 Subject: [PATCH 18/22] Add a VNC NxWM configuration to support further VNC testing --- ChangeLog | 4 +- configs/samv71-xult/README.txt | 163 ++- configs/samv71-xult/vnxwm/Make.defs | 117 ++ configs/samv71-xult/vnxwm/defconfig | 1567 +++++++++++++++++++++++++++ configs/samv71-xult/vnxwm/setenv.sh | 77 ++ 5 files changed, 1910 insertions(+), 18 deletions(-) create mode 100644 configs/samv71-xult/vnxwm/Make.defs create mode 100644 configs/samv71-xult/vnxwm/defconfig create mode 100644 configs/samv71-xult/vnxwm/setenv.sh diff --git a/ChangeLog b/ChangeLog index 3686531d89d..faa17d5bbf1 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11671,5 +11671,7 @@ * arch/arm/src/stm32 and configs/stm32f429i-disco: Correct some bad commits that broke the LTDC display example. From Marco Krahl (2016-04-22). - + * configs/samv71-xult/vnwwm: Add a more complex NxWM configuration + to support further VNC testing (particularly of VNC keyboard and + mouse intputs). Initial configuration is not functional (2016-04-23). diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 2530d33b2eb..1efb630215b 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -2206,25 +2206,25 @@ Configuration sub-directories The NxWM window manager can be found here: - nuttx-git/NxWidgets/nxwm + NxWidgets/nxwm The NxWM unit test can be found at: - nuttx-git/NxWidgets/UnitTests/nxwm + NxWidgets/UnitTests/nxwm Documentation for installing the NxWM unit test can be found here: - nuttx-git/NxWidgets/UnitTests/README.txt + NxWidgets/UnitTests/README.txt 2. Here is the quick summary of the build steps. These steps assume - that you have the entire NuttX GIT in some directory ~/nuttx-git. - You may have these components installed elsewhere. In that case, you + that you have the entire NuttX GIT in some directory HOME. You may + have these components installed elsewhere. In that case, you will need to adjust all of the paths in the following accordingly: - a. Install the nxwm configuration + a. Install the VNC nxwm configuration - $ cd ~/nuttx-git/nuttx/tools - $ ./configure.sh samv71-xult/nxwm + $ cd HOME/nuttx/tools + $ ./configure.sh samv71-xult/vnc b. Make the build context (only) @@ -2241,27 +2241,27 @@ Configuration sub-directories c. Install the nxwm unit test - $ cd ~/nuttx-git/NxWidgets - $ tools/install.sh ~/nuttx-git/apps nxwm + $ cd HOME/NxWidgets + $ tools/install.sh HOME/apps nxwm Creating symbolic link - - To ~/nuttx-git/NxWidgets/UnitTests/nxwm - - At ~/nuttx-git/apps/external + - To HOME/NxWidgets/UnitTests/nxwm + - At HOME/apps/external d. Build the NxWidgets library - $ cd ~/nuttx-git/NxWidgets/libnxwidgets - $ make TOPDIR=~/nuttx-git/nuttx + $ cd HOME/NxWidgets/libnxwidgets + $ make TOPDIR=HOME/nuttx ... e. Build the NxWM library - $ cd ~/nuttx-git/NxWidgets/nxwm - $ make TOPDIR=~/nuttx-git/nuttx + $ cd HOME/NxWidgets/nxwm + $ make TOPDIR=HOME/nuttx ... f. Built NuttX with the installed unit test as the application - $ cd ~/nuttx-git/nuttx + $ cd HOME/nuttx $ make 3. Reading from the LCD is not currently functional. The following @@ -2381,3 +2381,132 @@ Configuration sub-directories quality in the remote display (since it is also 8 BPP). At 8 BPP, the remote display is correct even with both GRAPHICS and UPDATER debug OFF -- and there is no hang! + + 2106-04-23: The NxImage example at apps/examplex/nximage. This was + selected because it is a very simple graphics test. Continued + testing, however, requires a more complex configuration. Hence, + the vnxwm configuration was created. + + vnxwm: + + This is a special configuration setup for the NxWM window manager + UnitTest. It provides an interactive windowing experience via a remote + VNC client window running on your PC. The SAMV71-XULT is connected to + the PC via Ethernet. + + NOTES: + + 1. The NxWM window manager is a tiny window manager tailored for use + with smaller LCDs. It supports a task, a start window, and + multiple application windows with toolbars. However, to make the + best use of the visible LCD space, only one application window is + visible at at time. + + The NxWM window manager can be found here: + + NxWidgets/nxwm + + The NxWM unit test can be found at: + + NxWidgets/UnitTests/nxwm + + Documentation for installing the NxWM unit test can be found here: + + NxWidgets/UnitTests/README.txt + + 2. Here is the quick summary of the build steps. These steps assume + that you have the entire NuttX GIT in some directory HOME. You may + have these components installed elsewhere. In that case, you + will need to adjust all of the paths in the following accordingly: + + a. Install the nxwm configuration + + $ cd HOME/nuttx/tools + $ ./configure.sh samv71-xult/nxwm + + b. Make the build context (only) + + $ cd .. + $ . ./setenv.sh + $ make context + ... + + NOTE: the use of the setenv.sh file is optional. All that it will + do is to adjust your PATH variable so that the build system can find + your tools. If you use it, you will most likely need to modify the + script so that it has the correct path to your tool binaries + directory. + + c. Install the nxwm unit test + + $ cd HOME/NxWidgets + $ tools/install.sh HOME/apps nxwm + Creating symbolic link + - To HOME/NxWidgets/UnitTests/nxwm + - At HOME/apps/external + + d. Build the NxWidgets library + + $ cd HOME/NxWidgets/libnxwidgets + $ make TOPDIR=HOME/nuttx + ... + + e. Build the NxWM library + + $ cd HOME/NxWidgets/nxwm + $ make TOPDIR=HOME/nuttx + ... + + f. Built NuttX with the installed unit test as the application + + $ cd HOME/nuttx + $ make + + 3. Network configuration: IP address 10.0.0.2. The is easily changed + via 'make menuconfig'. The VNC server address is 10.0.0.2:5900. + + 4. The default (local) framebuffer configuration is 320x240 with 8-bit + RGB color. + + I had some problems at 16-bits per pixle (see STATUS below). To + select 16-bits per pixel RGB15 5:6:5 + + CONFIG_NX_DISABLE_8BPP=y + # CONFIG_NX_DISABLE_16BPP is not set + + # CONFIG_VNCSERVER_COLORFMT_RGB8 is not set + CONFIG_VNCSERVER_COLORFMT_RGB16=y + + CONFIG_EXAMPLES_NXIMAGE_BPP=16 + + To re-select 8-bits per pixel RGB8 3:3:2 + + # CONFIG_NX_DISABLE_8BPP is not set + CONFIG_NX_DISABLE_16BPP=y + + CONFIG_VNCSERVER_COLORFMT_RGB8=y + # CONFIG_VNCSERVER_COLORFMT_RGB16 is not set + + # CONFIG_EXAMPLES_NXIMAGE_GREYSCALE is not set + CONFIG_EXAMPLES_NXIMAGE_BPP=8 + + 5. There are complicated interactions between VNC and the network + configuration. The CONFIG_VNCSERVER_UPDATE_BUFSIZE determines the + size of update messages. That is 1024 bytes in that configuration + (the full message with the header will be a little larger). The + MTU (CONFIG_NET_ETH_MTU) is set to 590 so that a full update will + require several packets. + + Write buffering also effects network performance. This will break + up the large updates into small (196 byte) groups. When we run out + of read-ahead buffers, then partial updates may be sent causing a + loss of synchronization. + + STATUS: + 2106-04-23: Configuration created. See status up to this data in + the vnc configuration. That probably all applies here as well. + + Only some initial testing has been performed: The configuration + does not work. No crashes or errors are reported, but the VNC + client window stays black. I have not yet dug into this. + \ No newline at end of file diff --git a/configs/samv71-xult/vnxwm/Make.defs b/configs/samv71-xult/vnxwm/Make.defs new file mode 100644 index 00000000000..fe4fd97aeb3 --- /dev/null +++ b/configs/samv71-xult/vnxwm/Make.defs @@ -0,0 +1,117 @@ +############################################################################ +# configs/samv71-xult/vnxwm/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config +include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs + +ifeq ($(CONFIG_ARMV7M_DTCM),y) + LDSCRIPT = flash-dtcm.ld +else + LDSCRIPT = flash-sram.ld +endif + +ifeq ($(WINTOOL),y) + # Windows-native toolchains + DIRLINK = $(TOPDIR)/tools/copydir.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mkwindeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}" +else + # Linux/Cygwin-native toolchain + MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT) + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT) +endif + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +endif + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing +ARCHWARNINGSXX = -Wall -Wshadow -Wundef +ARCHDEFINES = +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +ASMEXT = .S +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe +HOSTLDFLAGS = + diff --git a/configs/samv71-xult/vnxwm/defconfig b/configs/samv71-xult/vnxwm/defconfig new file mode 100644 index 00000000000..3e074f27096 --- /dev/null +++ b/configs/samv71-xult/vnxwm/defconfig @@ -0,0 +1,1567 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# + +# +# Build Setup +# +CONFIG_EXPERIMENTAL=y +# CONFIG_DEFAULT_SMALL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +CONFIG_BUILD_FLAT=y +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y +# CONFIG_UBOOT_UIMAGE is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDINT_H is not set +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set +# CONFIG_ARCH_DEBUG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_ARCH_HAVE_HEAPCHECK is not set +CONFIG_ARCH_HAVE_STACKCHECK=y +# CONFIG_STACK_COLORATION is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_ARCH_HAVE_CUSTOMOPT=y +# CONFIG_DEBUG_NOOPT is not set +# CONFIG_DEBUG_CUSTOMOPT is not set +CONFIG_DEBUG_FULLOPT=y + +# +# System Type +# +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_A1X is not set +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_EFM32 is not set +# CONFIG_ARCH_CHIP_IMX1 is not set +# CONFIG_ARCH_CHIP_IMX6 is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_KL is not set +# CONFIG_ARCH_CHIP_LM is not set +# CONFIG_ARCH_CHIP_TIVA is not set +# CONFIG_ARCH_CHIP_LPC11XX is not set +# CONFIG_ARCH_CHIP_LPC17XX is not set +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_NUC1XX is not set +# CONFIG_ARCH_CHIP_SAMA5 is not set +# CONFIG_ARCH_CHIP_SAMD is not set +# CONFIG_ARCH_CHIP_SAML is not set +# CONFIG_ARCH_CHIP_SAM34 is not set +CONFIG_ARCH_CHIP_SAMV7=y +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STM32F7 is not set +# CONFIG_ARCH_CHIP_STM32L4 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +# CONFIG_ARCH_CHIP_TMS570 is not set +# CONFIG_ARCH_CHIP_MOXART is not set +# CONFIG_ARCH_ARM7TDMI is not set +# CONFIG_ARCH_ARM926EJS is not set +# CONFIG_ARCH_ARM920T is not set +# CONFIG_ARCH_CORTEXM0 is not set +# CONFIG_ARCH_CORTEXM3 is not set +# CONFIG_ARCH_CORTEXM4 is not set +CONFIG_ARCH_CORTEXM7=y +# CONFIG_ARCH_CORTEXA5 is not set +# CONFIG_ARCH_CORTEXA8 is not set +# CONFIG_ARCH_CORTEXA9 is not set +# CONFIG_ARCH_CORTEXR4 is not set +# CONFIG_ARCH_CORTEXR4F is not set +# CONFIG_ARCH_CORTEXR5 is not set +# CONFIG_ARCH_CORTEX5F is not set +# CONFIG_ARCH_CORTEXR7 is not set +# CONFIG_ARCH_CORTEXR7F is not set +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="samv7" +# CONFIG_ARM_TOOLCHAIN_IAR is not set +CONFIG_ARM_TOOLCHAIN_GNU=y +# CONFIG_ARMV7M_USEBASEPRI is not set +CONFIG_ARCH_HAVE_CMNVECTOR=y +CONFIG_ARMV7M_CMNVECTOR=y +CONFIG_ARMV7M_LAZYFPU=y +CONFIG_ARCH_HAVE_FPU=y +CONFIG_ARCH_HAVE_DPFPU=y +CONFIG_ARCH_FPU=y +CONFIG_ARCH_DPFPU=y +# CONFIG_ARCH_HAVE_TRUSTZONE is not set +CONFIG_ARM_HAVE_MPU_UNIFIED=y +# CONFIG_ARM_MPU is not set + +# +# ARMV7M Configuration Options +# +CONFIG_ARMV7M_HAVE_ICACHE=y +CONFIG_ARMV7M_HAVE_DCACHE=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_HAVE_ITCM=y +CONFIG_ARMV7M_HAVE_DTCM=y +# CONFIG_ARMV7M_ITCM is not set +# CONFIG_ARMV7M_DTCM is not set +# CONFIG_ARMV7M_TOOLCHAIN_IARW is not set +# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set +# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW is not set +# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set +CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y +# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set +CONFIG_ARMV7M_HAVE_STACKCHECK=y +# CONFIG_ARMV7M_STACKCHECK is not set +# CONFIG_ARMV7M_ITMSYSLOG is not set +# CONFIG_SERIAL_TERMIOS is not set +CONFIG_SDIO_DMA=y +# CONFIG_SDIO_WIDTH_D1_ONLY is not set + +# +# SAMV7 Configuration Options +# +# CONFIG_ARCH_CHIP_SAME70Q19 is not set +# CONFIG_ARCH_CHIP_SAME70Q20 is not set +# CONFIG_ARCH_CHIP_SAME70Q21 is not set +# CONFIG_ARCH_CHIP_SAME70N19 is not set +# CONFIG_ARCH_CHIP_SAME70N20 is not set +# CONFIG_ARCH_CHIP_SAME70N21 is not set +# CONFIG_ARCH_CHIP_SAME70J19 is not set +# CONFIG_ARCH_CHIP_SAME70J20 is not set +# CONFIG_ARCH_CHIP_SAME70J21 is not set +# CONFIG_ARCH_CHIP_SAMV71Q19 is not set +# CONFIG_ARCH_CHIP_SAMV71Q20 is not set +CONFIG_ARCH_CHIP_SAMV71Q21=y +# CONFIG_ARCH_CHIP_SAMV71N19 is not set +# CONFIG_ARCH_CHIP_SAMV71N20 is not set +# CONFIG_ARCH_CHIP_SAMV71N21 is not set +# CONFIG_ARCH_CHIP_SAMV71J19 is not set +# CONFIG_ARCH_CHIP_SAMV71J20 is not set +# CONFIG_ARCH_CHIP_SAMV71J21 is not set +# CONFIG_ARCH_CHIP_SAME70 is not set +# CONFIG_ARCH_CHIP_SAME70Q is not set +# CONFIG_ARCH_CHIP_SAME70N is not set +# CONFIG_ARCH_CHIP_SAME70J is not set +CONFIG_ARCH_CHIP_SAMV71=y +CONFIG_ARCH_CHIP_SAMV71Q=y +# CONFIG_ARCH_CHIP_SAMV71N is not set +# CONFIG_ARCH_CHIP_SAMV71J is not set +# CONFIG_SAMV7_MCAN is not set +CONFIG_SAMV7_HAVE_MCAN1=y +CONFIG_SAMV7_HAVE_DAC1=y +CONFIG_SAMV7_HAVE_EBI=y +CONFIG_SAMV7_EMAC=y +CONFIG_SAMV7_HSMCI=y +CONFIG_SAMV7_HAVE_HSMCI0=y +# CONFIG_SAMV7_HAVE_ISI8 is not set +CONFIG_SAMV7_HAVE_MEDIALB=y +CONFIG_SAMV7_HAVE_SDRAMC=y +CONFIG_SAMV7_HAVE_SPI0=y +CONFIG_SAMV7_HAVE_SPI1=y +# CONFIG_SAMV7_QSPI_IS_SPI is not set +# CONFIG_SAMV7_SSC is not set +# CONFIG_SAMV7_HAVE_TC is not set +CONFIG_SAMV7_HAVE_TWIHS2=y +# CONFIG_SAMV7_HAVE_USBFS is not set +CONFIG_SAMV7_HAVE_USBHS=y +CONFIG_SAMV7_HAVE_USART0=y +CONFIG_SAMV7_HAVE_USART1=y +CONFIG_SAMV7_HAVE_USART2=y +# CONFIG_SAMV7_SPI is not set +# CONFIG_SAMV7_SPI_MASTER is not set +# CONFIG_SAMV7_SPI_SLAVE is not set + +# +# SAMV7 Peripheral Selection +# +# CONFIG_SAMV7_ACC is not set +# CONFIG_SAMV7_ADC is not set +# CONFIG_SAMV7_AFEC0 is not set +# CONFIG_SAMV7_AFEC1 is not set +# CONFIG_SAMV7_MCAN0 is not set +# CONFIG_SAMV7_MCAN1 is not set +# CONFIG_SAMV7_DAC0 is not set +# CONFIG_SAMV7_DAC1 is not set +# CONFIG_SAMV7_EBI is not set +CONFIG_SAMV7_EMAC0=y +CONFIG_SAMV7_XDMAC=y +CONFIG_SAMV7_HSMCI0=y +# CONFIG_SAMV7_ISI is not set +# CONFIG_SAMV7_MLB is not set +# CONFIG_SAMV7_PWM0 is not set +# CONFIG_SAMV7_PWM1 is not set +# CONFIG_SAMV7_QSPI is not set +# CONFIG_SAMV7_RTC is not set +# CONFIG_SAMV7_RTT is not set +# CONFIG_SAMV7_SDRAMC is not set +# CONFIG_SAMV7_SMC is not set +# CONFIG_SAMV7_SPI0 is not set +# CONFIG_SAMV7_SPI1 is not set +# CONFIG_SAMV7_SSC0 is not set +# CONFIG_SAMV7_TC0 is not set +# CONFIG_SAMV7_TC1 is not set +# CONFIG_SAMV7_TC2 is not set +# CONFIG_SAMV7_TC3 is not set +# CONFIG_SAMV7_TRNG is not set +CONFIG_SAMV7_TWIHS0=y +# CONFIG_SAMV7_TWIHS1 is not set +# CONFIG_SAMV7_TWIHS2 is not set +# CONFIG_SAMV7_UART0 is not set +# CONFIG_SAMV7_UART1 is not set +# CONFIG_SAMV7_UART2 is not set +CONFIG_SAMV7_UART3=y +# CONFIG_SAMV7_UART4 is not set +# CONFIG_SAMV7_USBDEVHS is not set +# CONFIG_SAMV7_USBHOSTHS is not set +# CONFIG_SAMV7_USART0 is not set +# CONFIG_SAMV7_USART1 is not set +# CONFIG_SAMV7_USART2 is not set +# CONFIG_SAMV7_WDT is not set +# CONFIG_SAMV7_RSWDT is not set +CONFIG_SAMV7_GPIO_IRQ=y +CONFIG_SAMV7_GPIOA_IRQ=y +CONFIG_SAMV7_GPIOB_IRQ=y +# CONFIG_SAMV7_GPIOC_IRQ is not set +CONFIG_SAMV7_GPIOD_IRQ=y +# CONFIG_SAMV7_GPIOE_IRQ is not set +# CONFIG_SAMV7_PROGMEM is not set + +# +# TWIHS device driver options +# +CONFIG_SAMV7_TWIHS0_FREQUENCY=100000 + +# +# HSMCI device driver options +# +# CONFIG_SAMV7_HSMCI_RDPROOF is not set +# CONFIG_SAMV7_HSMCI_WRPROOF is not set +# CONFIG_SAMV7_HSMCI_UNALIGNED is not set + +# +# EMAC device driver options +# +CONFIG_SAMV7_EMAC0_NRXBUFFERS=16 +CONFIG_SAMV7_EMAC0_NTXBUFFERS=8 +CONFIG_SAMV7_EMAC0_PHYADDR=1 +# CONFIG_SAMV7_EMAC0_PHYINIT is not set +# CONFIG_SAMV7_EMAC0_MII is not set +CONFIG_SAMV7_EMAC0_RMII=y +CONFIG_SAMV7_EMAC0_AUTONEG=y +CONFIG_SAMV7_EMAC0_PHYSR=30 +CONFIG_SAMV7_EMAC0_PHYSR_ALTCONFIG=y +CONFIG_SAMV7_EMAC0_PHYSR_ALTMODE=0x7 +CONFIG_SAMV7_EMAC0_PHYSR_10HD=0x1 +CONFIG_SAMV7_EMAC0_PHYSR_100HD=0x2 +CONFIG_SAMV7_EMAC0_PHYSR_10FD=0x5 +CONFIG_SAMV7_EMAC0_PHYSR_100FD=0x6 +CONFIG_SAMV7_EMAC0_ISETH0=y +# CONFIG_SAMV7_EMAC_PREALLOCATE is not set +# CONFIG_SAMV7_EMAC_NBC is not set + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set +CONFIG_ARCH_DMA=y +CONFIG_ARCH_HAVE_IRQPRIO=y +# CONFIG_ARCH_L2CACHE is not set +# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set +# CONFIG_ARCH_HAVE_ADDRENV is not set +# CONFIG_ARCH_NEED_ADDRENV_MAPPING is not set +# CONFIG_ARCH_HAVE_MULTICPU is not set +CONFIG_ARCH_HAVE_VFORK=y +# CONFIG_ARCH_HAVE_MMU is not set +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARCH_NAND_HWECC is not set +# CONFIG_ARCH_HAVE_EXTCLK is not set +# CONFIG_ARCH_HAVE_POWEROFF is not set +# CONFIG_ARCH_HAVE_RESET is not set +# CONFIG_ARCH_USE_MPU is not set +# CONFIG_ARCH_IRQPRIO is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_IDLE_CUSTOM is not set +CONFIG_ARCH_HAVE_RAMFUNCS=y +# CONFIG_ARCH_RAMFUNCS is not set +CONFIG_ARCH_HAVE_RAMVECTORS=y +# CONFIG_ARCH_RAMVECTORS is not set + +# +# Board Settings +# +CONFIG_BOARD_LOOPSPERMSEC=51262 +# CONFIG_ARCH_CALIBRATION is not set + +# +# Interrupt options +# +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_HAVE_HIPRI_INTERRUPT=y +# CONFIG_ARCH_HIPRI_INTERRUPT is not set + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Boot Memory Configuration +# +CONFIG_RAM_START=0x20400000 +CONFIG_RAM_SIZE=393216 +# CONFIG_ARCH_HAVE_SDRAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_SAMV71_XULT=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="samv71-xult" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +CONFIG_ARCH_BUTTONS=y +CONFIG_ARCH_HAVE_IRQBUTTONS=y +CONFIG_ARCH_IRQBUTTONS=y +CONFIG_NSH_MMCSDMINOR=0 +CONFIG_NSH_MMCSDSLOTNO=0 + +# +# Board-Specific Options +# +# CONFIG_SAMV71XULT_MXTXPLND is not set +CONFIG_LIB_BOARDCTL=y +# CONFIG_BOARDCTL_UNIQUEID is not set +# CONFIG_BOARDCTL_TSCTEST is not set +# CONFIG_BOARDCTL_ADCTEST is not set +# CONFIG_BOARDCTL_PWMTEST is not set +# CONFIG_BOARDCTL_GRAPHICS is not set +# CONFIG_BOARDCTL_IOCTL is not set + +# +# RTOS Features +# +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_ENVIRON is not set + +# +# Clocks and Timers +# +CONFIG_ARCH_HAVE_TICKLESS=y +# CONFIG_SCHED_TICKLESS is not set +CONFIG_USEC_PER_TICK=10000 +# CONFIG_SYSTEM_TIME64 is not set +# CONFIG_CLOCK_MONOTONIC is not set +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2014 +CONFIG_START_MONTH=3 +CONFIG_START_DAY=10 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=32 +CONFIG_WDOG_INTRESERVE=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Tasks and Scheduling +# +# CONFIG_SPINLOCK is not set +# CONFIG_INIT_NONE is not set +CONFIG_INIT_ENTRYPOINT=y +# CONFIG_INIT_FILEPATH is not set +CONFIG_USER_ENTRYPOINT="nxwm_main" +CONFIG_RR_INTERVAL=200 +# CONFIG_SCHED_SPORADIC is not set +CONFIG_TASK_NAME_SIZE=31 +CONFIG_MAX_TASKS=16 +CONFIG_SCHED_HAVE_PARENT=y +# CONFIG_SCHED_CHILD_STATUS is not set +CONFIG_SCHED_WAITPID=y + +# +# Pthread Options +# +# CONFIG_MUTEX_TYPES is not set +CONFIG_NPTHREAD_KEYS=4 + +# +# Performance Monitoring +# +# CONFIG_SCHED_CPULOAD is not set +# CONFIG_SCHED_INSTRUMENTATION is not set + +# +# Files and I/O +# +CONFIG_DEV_CONSOLE=y +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +# CONFIG_PRIORITY_INHERITANCE is not set + +# +# RTOS hooks +# +# CONFIG_BOARD_INITIALIZE is not set +# CONFIG_SCHED_STARTHOOK is not set +# CONFIG_SCHED_ATEXIT is not set +CONFIG_SCHED_ONEXIT=y +CONFIG_SCHED_ONEXIT_MAX=1 +# CONFIG_SIG_EVTHREAD is not set + +# +# Signal Numbers +# +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCHLD=4 +CONFIG_SIG_SIGCONDTIMEDOUT=16 +CONFIG_SIG_SIGWORK=17 + +# +# POSIX Message Queue Options +# +CONFIG_PREALLOC_MQ_MSGS=32 +CONFIG_MQ_MAXMSGSIZE=64 +# CONFIG_MODULE is not set + +# +# Work queue support +# +CONFIG_SCHED_WORKQUEUE=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_HPWORKPERIOD=50000 +CONFIG_SCHED_HPWORKSTACKSIZE=2048 +# CONFIG_SCHED_LPWORK is not set + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=1526 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 +# CONFIG_LIB_SYSCALL is not set + +# +# Device Drivers +# +CONFIG_DISABLE_POLL=y +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_DEV_LOOP is not set + +# +# Buffering +# +# CONFIG_DRVR_WRITEBUFFER is not set +# CONFIG_DRVR_READAHEAD is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set +# CONFIG_ARCH_HAVE_PWM_MULTICHAN is not set +# CONFIG_PWM is not set +# CONFIG_ARCH_HAVE_I2CRESET is not set +CONFIG_I2C=y +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_POLLED is not set +# CONFIG_I2C_TRACE is not set +CONFIG_I2C_DRIVER=y +CONFIG_SPI=y +# CONFIG_SPI_SLAVE is not set +CONFIG_SPI_EXCHANGE=y +# CONFIG_SPI_CMDDATA is not set +# CONFIG_SPI_CALLBACK is not set +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_HWFEATURES is not set +# CONFIG_SPI_CRCGENERATION is not set +# CONFIG_I2S is not set + +# +# Timer Driver Support +# +# CONFIG_TIMER is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_TIMERS_CS2100CP is not set +# CONFIG_ANALOG is not set +# CONFIG_AUDIO_DEVICES is not set +# CONFIG_VIDEO_DEVICES is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_IOEXPANDER is not set +# CONFIG_LCD is not set + +# +# LED Support +# +# CONFIG_USERLED is not set +# CONFIG_RGBLED is not set +# CONFIG_PCA9635PW is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +# CONFIG_MMCSD_MMCSUPPORT is not set +CONFIG_MMCSD_HAVECARDDETECT=y +# CONFIG_MMCSD_SPI is not set +CONFIG_ARCH_HAVE_SDIO=y +# CONFIG_ARCH_HAVE_SDIOWAIT_WRCOMPLETE is not set +CONFIG_MMCSD_SDIO=y +# CONFIG_SDIO_PREFLIGHT is not set +# CONFIG_SDIO_MUXBUS is not set +CONFIG_SDIO_BLOCKSETUP=y +# CONFIG_MODEM is not set +CONFIG_MTD=y + +# +# MTD Configuration +# +# CONFIG_MTD_PARTITION is not set +# CONFIG_MTD_SECT512 is not set +# CONFIG_MTD_BYTE_WRITE is not set +# CONFIG_MTD_PROGMEM is not set +CONFIG_MTD_CONFIG=y +# CONFIG_MTD_CONFIG_RAM_CONSOLIDATE is not set +CONFIG_MTD_CONFIG_ERASEDVALUE=0xff + +# +# MTD Device Drivers +# +# CONFIG_MTD_NAND is not set +# CONFIG_RAMMTD is not set +# CONFIG_FILEMTD is not set +CONFIG_MTD_AT24XX=y +# CONFIG_AT24XX_MULTI is not set +CONFIG_AT24XX_SIZE=2 +CONFIG_AT24XX_ADDR=0x57 +CONFIG_AT24XX_EXTENDED=y +CONFIG_AT24XX_EXTSIZE=160 +CONFIG_AT24XX_FREQUENCY=100000 +CONFIG_MTD_AT25=y +CONFIG_AT25_SPIMODE=0 +CONFIG_AT25_SPIFREQUENCY=20000000 +# CONFIG_MTD_AT45DB is not set +# CONFIG_MTD_M25P is not set +# CONFIG_MTD_S25FL1 is not set +# CONFIG_MTD_N25QXXX is not set +# CONFIG_MTD_SMART is not set +# CONFIG_MTD_RAMTRON is not set +# CONFIG_MTD_SST25 is not set +# CONFIG_MTD_SST25XX is not set +# CONFIG_MTD_SST39FV is not set +# CONFIG_MTD_W25 is not set +# CONFIG_EEPROM is not set +CONFIG_NETDEVICES=y + +# +# General Ethernet MAC Driver Options +# +# CONFIG_NETDEV_LOOPBACK is not set +CONFIG_NETDEV_TELNET=y +CONFIG_TELNET_RXBUFFER_SIZE=256 +CONFIG_TELNET_TXBUFFER_SIZE=256 +# CONFIG_NETDEV_MULTINIC is not set +CONFIG_ARCH_HAVE_NETDEV_STATISTICS=y +CONFIG_NETDEV_STATISTICS=y +# CONFIG_NETDEV_LATEINIT is not set + +# +# External Ethernet MAC Device Support +# +# CONFIG_NET_DM90x0 is not set +# CONFIG_NET_CS89x0 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set +# CONFIG_NET_E1000 is not set +# CONFIG_NET_SLIP is not set +# CONFIG_NET_FTMAC100 is not set +# CONFIG_NET_VNET is not set + +# +# External Ethernet PHY Device Support +# +CONFIG_ARCH_PHY_INTERRUPT=y +# CONFIG_ETH0_PHY_NONE is not set +# CONFIG_ETH0_PHY_AM79C874 is not set +# CONFIG_ETH0_PHY_KS8721 is not set +# CONFIG_ETH0_PHY_KSZ8041 is not set +# CONFIG_ETH0_PHY_KSZ8051 is not set +CONFIG_ETH0_PHY_KSZ8061=y +# CONFIG_ETH0_PHY_KSZ8081 is not set +# CONFIG_ETH0_PHY_KSZ90x1 is not set +# CONFIG_ETH0_PHY_DP83848C is not set +# CONFIG_ETH0_PHY_LAN8720 is not set +# CONFIG_ETH0_PHY_LAN8740 is not set +# CONFIG_ETH0_PHY_LAN8740A is not set +# CONFIG_ETH0_PHY_LAN8742A is not set +# CONFIG_ETH0_PHY_DM9161 is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +# CONFIG_ARCH_HAVE_UART is not set +# CONFIG_ARCH_HAVE_UART0 is not set +# CONFIG_ARCH_HAVE_UART1 is not set +# CONFIG_ARCH_HAVE_UART2 is not set +CONFIG_ARCH_HAVE_UART3=y +# CONFIG_ARCH_HAVE_UART4 is not set +# CONFIG_ARCH_HAVE_UART5 is not set +# CONFIG_ARCH_HAVE_UART6 is not set +# CONFIG_ARCH_HAVE_UART7 is not set +# CONFIG_ARCH_HAVE_UART8 is not set +# CONFIG_ARCH_HAVE_SCI0 is not set +# CONFIG_ARCH_HAVE_SCI1 is not set +# CONFIG_ARCH_HAVE_USART0 is not set +# CONFIG_ARCH_HAVE_USART1 is not set +# CONFIG_ARCH_HAVE_USART2 is not set +# CONFIG_ARCH_HAVE_USART3 is not set +# CONFIG_ARCH_HAVE_USART4 is not set +# CONFIG_ARCH_HAVE_USART5 is not set +# CONFIG_ARCH_HAVE_USART6 is not set +# CONFIG_ARCH_HAVE_USART7 is not set +# CONFIG_ARCH_HAVE_USART8 is not set +# CONFIG_ARCH_HAVE_OTHER_UART is not set + +# +# USART Configuration +# +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +# CONFIG_SERIAL_IFLOWCONTROL is not set +# CONFIG_SERIAL_OFLOWCONTROL is not set +# CONFIG_SERIAL_DMA is not set +CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y +CONFIG_UART3_SERIAL_CONSOLE=y +# CONFIG_OTHER_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART3 Configuration +# +CONFIG_UART3_RXBUFSIZE=256 +CONFIG_UART3_TXBUFSIZE=256 +CONFIG_UART3_BAUD=115200 +CONFIG_UART3_BITS=8 +CONFIG_UART3_PARITY=0 +CONFIG_UART3_2STOP=0 +# CONFIG_UART3_IFLOWCONTROL is not set +# CONFIG_UART3_OFLOWCONTROL is not set +# CONFIG_UART3_DMA is not set +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_DRIVERS_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set +# CONFIG_SYSLOG_CONSOLE is not set + +# +# Networking Support +# +CONFIG_ARCH_HAVE_NET=y +CONFIG_ARCH_HAVE_PHY=y +CONFIG_NET=y +CONFIG_NET_NOINTS=y +# CONFIG_NET_PROMISCUOUS is not set + +# +# Driver buffer configuration +# +# CONFIG_NET_MULTIBUFFER is not set +CONFIG_NET_ETH_MTU=590 +CONFIG_NET_ETH_TCP_RECVWNDO=536 +CONFIG_NET_GUARDSIZE=2 + +# +# Data link support +# +# CONFIG_NET_MULTILINK is not set +# CONFIG_NET_USER_DEVFMT is not set +CONFIG_NET_ETHERNET=y +# CONFIG_NET_LOOPBACK is not set +# CONFIG_NET_TUN is not set + +# +# Network Device Operations +# +CONFIG_NETDEV_PHY_IOCTL=y + +# +# Internet Protocol Selection +# +CONFIG_NET_IPv4=y +# CONFIG_NET_IPv6 is not set + +# +# Socket Support +# +CONFIG_NSOCKET_DESCRIPTORS=8 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +# CONFIG_NET_SOLINGER is not set + +# +# Raw Socket Support +# +# CONFIG_NET_PKT is not set + +# +# Unix Domain Socket Support +# +# CONFIG_NET_LOCAL is not set + +# +# TCP/IP Networking +# +CONFIG_NET_TCP=y +# CONFIG_NET_TCPURGDATA is not set +# CONFIG_NET_TCP_REASSEMBLY is not set +CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_MAX_LISTENPORTS=20 +CONFIG_NET_TCP_READAHEAD=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_TCP_NWRBCHAINS=8 +CONFIG_NET_TCP_RECVDELAY=0 +CONFIG_NET_TCPBACKLOG=y +# CONFIG_NET_SENDFILE is not set + +# +# UDP Networking +# +# CONFIG_NET_UDP is not set + +# +# ICMP Networking Support +# +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_PING=y + +# +# IGMPv2 Client Support +# +# CONFIG_NET_IGMP is not set + +# +# ARP Configuration +# +CONFIG_NET_ARP=y +CONFIG_NET_ARPTAB_SIZE=16 +CONFIG_NET_ARP_MAXAGE=120 +# CONFIG_NET_ARP_IPIN is not set +CONFIG_NET_ARP_SEND=y +CONFIG_ARP_SEND_MAXTRIES=5 +CONFIG_ARP_SEND_DELAYMSEC=20 + +# +# Network I/O Buffer Support +# +CONFIG_NET_IOB=y +CONFIG_IOB_NBUFFERS=72 +CONFIG_IOB_BUFSIZE=196 +CONFIG_IOB_NCHAINS=8 +CONFIG_IOB_THROTTLE=32 +# CONFIG_NET_ARCH_INCR32 is not set +# CONFIG_NET_ARCH_CHKSUM is not set +CONFIG_NET_STATISTICS=y + +# +# Routing Table Configuration +# +# CONFIG_NET_ROUTE is not set +CONFIG_NET_HOSTNAME="SAMV71-XULT" + +# +# Crypto API +# +# CONFIG_CRYPTO is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_FS_AUTOMOUNTER is not set +# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set +CONFIG_FS_READABLE=y +CONFIG_FS_WRITABLE=y +# CONFIG_FS_NAMED_SEMAPHORES is not set +CONFIG_FS_MQUEUE_MPATH="/var/mqueue" +# CONFIG_FS_RAMMAP is not set +CONFIG_FS_FAT=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=32 +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_FORCE_INDIRECT is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FAT_DIRECT_RETRY is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set +# CONFIG_FS_TMPFS is not set +# CONFIG_FS_SMARTFS is not set +# CONFIG_FS_BINFS is not set +CONFIG_FS_PROCFS=y +# CONFIG_FS_PROCFS_REGISTER is not set + +# +# Exclude individual procfs entries +# +# CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set +# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set +# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set +# CONFIG_FS_PROCFS_EXCLUDE_NET is not set +# CONFIG_FS_PROCFS_EXCLUDE_MTD is not set +# CONFIG_FS_UNIONFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set +# CONFIG_SYSLOG_TIMESTAMP is not set + +# +# Graphics Support +# +CONFIG_NX=y +CONFIG_NX_NPLANES=1 +CONFIG_NX_BGCOLOR=0xbb +# CONFIG_NX_WRITEONLY is not set +CONFIG_NX_UPDATE=y + +# +# Supported Pixel Depths +# +CONFIG_NX_DISABLE_1BPP=y +CONFIG_NX_DISABLE_2BPP=y +CONFIG_NX_DISABLE_4BPP=y +# CONFIG_NX_DISABLE_8BPP is not set +CONFIG_NX_DISABLE_16BPP=y +CONFIG_NX_DISABLE_24BPP=y +CONFIG_NX_DISABLE_32BPP=y +CONFIG_NX_PACKEDMSFIRST=y + +# +# Input Devices +# +CONFIG_NX_XYINPUT=y +# CONFIG_NX_XYINPUT_NONE is not set +CONFIG_NX_XYINPUT_MOUSE=y +# CONFIG_NX_XYINPUT_TOUCHSCREEN is not set +CONFIG_NX_KBD=y + +# +# Framed Window Borders +# +CONFIG_NXTK_BORDERWIDTH=4 +CONFIG_NXTK_DEFAULT_BORDERCOLORS=y +# CONFIG_NXTK_AUTORAISE is not set + +# +# Font Selections +# +CONFIG_NXFONTS_CHARBITS=7 +# CONFIG_NXFONT_MONO5X8 is not set +# CONFIG_NXFONT_SANS17X22 is not set +# CONFIG_NXFONT_SANS20X26 is not set +CONFIG_NXFONT_SANS23X27=y +# CONFIG_NXFONT_SANS22X29 is not set +# CONFIG_NXFONT_SANS28X37 is not set +# CONFIG_NXFONT_SANS39X48 is not set +# CONFIG_NXFONT_SANS17X23B is not set +# CONFIG_NXFONT_SANS20X27B is not set +CONFIG_NXFONT_SANS22X29B=y +# CONFIG_NXFONT_SANS28X37B is not set +# CONFIG_NXFONT_SANS40X49B is not set +# CONFIG_NXFONT_SERIF22X29 is not set +# CONFIG_NXFONT_SERIF29X37 is not set +# CONFIG_NXFONT_SERIF38X48 is not set +# CONFIG_NXFONT_SERIF22X28B is not set +# CONFIG_NXFONT_SERIF27X38B is not set +# CONFIG_NXFONT_SERIF38X49B is not set +# CONFIG_NXFONT_PIXEL_UNICODE is not set +# CONFIG_NXFONT_PIXEL_LCD_MACHINE is not set +# CONFIG_NXFONT_X11_MISC_FIXED_4X6 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_5X7 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_5X8 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_6X9 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_6X10 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_6X12 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_6X13 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_6X13B is not set +# CONFIG_NXFONT_X11_MISC_FIXED_6X13O is not set +# CONFIG_NXFONT_X11_MISC_FIXED_7X13 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_7X13B is not set +# CONFIG_NXFONT_X11_MISC_FIXED_7X13O is not set +# CONFIG_NXFONT_X11_MISC_FIXED_7X14 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_7X14B is not set +# CONFIG_NXFONT_X11_MISC_FIXED_8X13 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_8X13B is not set +# CONFIG_NXFONT_X11_MISC_FIXED_8X13O is not set +# CONFIG_NXFONT_X11_MISC_FIXED_9X15 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_9X15B is not set +# CONFIG_NXFONT_X11_MISC_FIXED_9X18 is not set +# CONFIG_NXFONT_X11_MISC_FIXED_9X18B is not set +# CONFIG_NXFONT_X11_MISC_FIXED_10X20 is not set +CONFIG_NXTERM=y + +# +# NxTerm Output Text/Graphics Options +# +CONFIG_NXTERM_BPP=8 +CONFIG_NXTERM_CURSORCHAR=137 +CONFIG_NXTERM_MXCHARS=396 +CONFIG_NXTERM_CACHESIZE=32 +CONFIG_NXTERM_LINESEPARATION=0 +# CONFIG_NXTERM_NOWRAP is not set + +# +# NxTerm Input options +# +CONFIG_NXTERM_NXKBDIN=y +CONFIG_NXTERM_KBDBUFSIZE=16 +CONFIG_NXTERM_NPOLLWAITERS=4 + +# +# NX Multi-user only options +# +CONFIG_NX_MULTIUSER=y +CONFIG_NX_BLOCKING=y +CONFIG_NX_MXSERVERMSGS=32 +CONFIG_NX_MXCLIENTMSGS=16 +# CONFIG_NX_NXSTART is not set +CONFIG_VNCSERVER=y +# CONFIG_VNCSERVER_PROTO3p3 is not set +CONFIG_VNCSERVER_PROTO3p8=y +CONFIG_VNCSERVER_NDISPLAYS=1 +CONFIG_VNCSERVER_NAME="NuttX" +CONFIG_VNCSERVER_PRIO=100 +CONFIG_VNCSERVER_STACKSIZE=2048 +CONFIG_VNCSERVER_UPDATER_PRIO=100 +CONFIG_VNCSERVER_UPDATER_STACKSIZE=2048 +CONFIG_VNCSERVER_COLORFMT_RGB8=y +# CONFIG_VNCSERVER_COLORFMT_RGB16 is not set +# CONFIG_VNCSERVER_COLORFMT_RGB32 is not set +CONFIG_VNCSERVER_SCREENWIDTH=320 +CONFIG_VNCSERVER_SCREENHEIGHT=240 +CONFIG_VNCSERVER_NUPDATES=48 +CONFIG_VNCSERVER_UPDATE_BUFSIZE=1024 +CONFIG_VNCSERVER_INBUFFER_SIZE=80 +# CONFIG_VNCCLIENT is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_ARCH_HAVE_HEAP2 is not set +# CONFIG_GRAN is not set + +# +# Audio Support +# +# CONFIG_AUDIO is not set + +# +# Wireless Support +# +# CONFIG_WIRELESS is not set + +# +# Binary Loader +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +CONFIG_BUILTIN=y +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=64 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +CONFIG_LIBM=y +# CONFIG_NOPRINTF_FIELDWIDTH is not set +CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_LIBC_LONG_LONG=y +# CONFIG_LIBC_IOCTL_VARIADIC is not set +CONFIG_LIB_RAND_ORDER=1 +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set +CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 +CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048 +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_LIBC_TMPDIR="/tmp" +CONFIG_LIBC_MAX_TMPFILE=32 +CONFIG_ARCH_LOWPUTC=y +# CONFIG_LIBC_LOCALTIME is not set +# CONFIG_TIME_EXTENDED is not set +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set +CONFIG_ARCH_HAVE_TLS=y +# CONFIG_TLS is not set +CONFIG_LIBC_NETDB=y +# CONFIG_NETDB_HOSTFILE is not set + +# +# Non-standard Library Support +# +# CONFIG_LIB_KBDCODEC is not set +# CONFIG_LIB_SLCDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +# CONFIG_CXX_NEWLONG is not set + +# +# uClibc++ Standard C++ Library +# +# CONFIG_UCLIBCXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + +# +# CAN Utilities +# + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CHAT is not set +# CONFIG_EXAMPLES_CONFIGDATA is not set +# CONFIG_EXAMPLES_CPUHOG is not set +# CONFIG_EXAMPLES_CXXTEST is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FSTEST is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_MEDIA is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NRF24L01TERM is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXTERM is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PCA9635 is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_PPPD is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_RGBLED is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERIALBLASTER is not set +# CONFIG_EXAMPLES_SERIALRX is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_SLCD is not set +# CONFIG_EXAMPLES_SMART_TEST is not set +# CONFIG_EXAMPLES_SMART is not set +# CONFIG_EXAMPLES_SMP is not set +# CONFIG_EXAMPLES_TCPECHO is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_WEBSERVER is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# File System Utilities +# +# CONFIG_FSUTILS_INIFILE is not set +# CONFIG_FSUTILS_PASSWD is not set + +# +# GPS Utilities +# +# CONFIG_GPSUTILS_MINMEA_LIB is not set + +# +# Graphics Support +# +# CONFIG_TIFF is not set +# CONFIG_GRAPHICS_TRAVELER is not set + +# +# Interpreters +# +# CONFIG_INTERPRETERS_BAS is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set +# CONFIG_INTERPRETERS_MICROPYTHON is not set + +# +# FreeModBus +# +# CONFIG_MODBUS is not set + +# +# Network Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_SMTP is not set +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_NETLIB=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NSH_WGET_USERAGENT="NuttX/6.xx.x (; http://www.nuttx.org/)" +CONFIG_WEBCLIENT_TIMEOUT=10 +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_XMLRPC is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y +CONFIG_NSH_MOTD=y +# CONFIG_NSH_PLATFORM_MOTD is not set +CONFIG_NSH_MOTD_STRING="VNC Server at 10.0.0.2:5900" + +# +# Command Line Configuration +# +CONFIG_NSH_READLINE=y +# CONFIG_NSH_CLE is not set +CONFIG_NSH_LINELEN=64 +# CONFIG_NSH_DISABLE_SEMICOLON is not set +CONFIG_NSH_CMDPARMS=y +CONFIG_NSH_MAXARGUMENTS=6 +CONFIG_NSH_ARGCAT=y +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_BUILTIN_APPS=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_ADDROUTE is not set +# CONFIG_NSH_DISABLE_ARP is not set +# CONFIG_NSH_DISABLE_BASENAME is not set +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_CMP is not set +CONFIG_NSH_DISABLE_DATE=y +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_DF is not set +# CONFIG_NSH_DISABLE_DELROUTE is not set +# CONFIG_NSH_DISABLE_DIRNAME is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_IFUPDOWN is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +CONFIG_NSH_DISABLE_LOSMART=y +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MV is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TIME is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNAME is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set + +# +# Configure Command Options +# +# CONFIG_NSH_CMDOPT_DF_H is not set +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_CMDOPT_HEXDUMP=y +CONFIG_NSH_PROC_MOUNTPOINT="/proc" +CONFIG_NSH_FILEIOSIZE=512 + +# +# Scripting Support +# +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLE_ITEF is not set +# CONFIG_NSH_DISABLE_LOOPS is not set + +# +# Console Configuration +# +CONFIG_NSH_CONSOLE=y +CONFIG_NSH_ARCHINIT=y + +# +# Networking Configuration +# +CONFIG_NSH_NETINIT_THREAD=y +CONFIG_NSH_NETINIT_THREAD_STACKSIZE=1568 +CONFIG_NSH_NETINIT_THREAD_PRIORITY=80 + +# +# IP Address Configuration +# + +# +# IPv4 Addresses +# +CONFIG_NSH_IPADDR=0x0a000002 +CONFIG_NSH_DRIPADDR=0x0a000001 +CONFIG_NSH_NETMASK=0xffffff00 +# CONFIG_NSH_NOMAC is not set +CONFIG_NSH_MAX_ROUNDTRIP=20 + +# +# Telnet Configuration +# +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 +CONFIG_NSH_IOBUFFER_SIZE=512 +# CONFIG_NSH_LOGIN is not set +# CONFIG_NSH_CONSOLE_LOGIN is not set +# CONFIG_NSH_TELNET_LOGIN is not set + +# +# NxWidgets/NxWM +# +CONFIG_NXWIDGETS=y + +# +# NX Server/Device Configuration +# +# CONFIG_NXWIDGETS_FLICKERFREE is not set +# CONFIG_NXWIDGETS_EXTERNINIT is not set +CONFIG_NXWIDGETS_VPLANE=0 +CONFIG_NXWIDGET_SERVERINIT=y +CONFIG_NXWIDGETS_SERVERPRIO=110 +CONFIG_NXWIDGETS_SERVERSTACK=2048 +CONFIG_NXWIDGETS_CLIENTPRIO=100 +CONFIG_NXWIDGETS_LISTENERPRIO=100 +CONFIG_NXWIDGETS_LISTENERSTACK=2048 +# CONFIG_NXWIDGET_EVENTWAIT is not set + +# +# NXWidget Configuration +# +CONFIG_NXWIDGETS_BPP=8 +# CONFIG_NXWIDGETS_GREYSCALE is not set +CONFIG_NXWIDGETS_SIZEOFCHAR=1 + +# +# NXWidget Default Values +# +# CONFIG_NXWIDGETS_SYSTEM_CUSTOM_FONTID is not set +CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE=16 +CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT=8 +# CONFIG_NXWIDGETS_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWIDGETS_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWIDGETS_CUSTOM_TEXTCOLORS is not set +CONFIG_NXWIDGETS_TRANSPARENT_COLOR=0x0 + +# +# Keypad behavior +# +CONFIG_NXWIDGETS_FIRST_REPEAT_TIME=500 +CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME=200 +CONFIG_NXWIDGETS_DOUBLECLICK_TIME=350 +CONFIG_NXWIDGETS_KBDBUFFER_SIZE=16 +CONFIG_NXWIDGETS_CURSORCONTROL_SIZE=4 +# CONFIG_NXWIDGET_MEMMONITOR is not set +CONFIG_NXWM=y + +# +# NxWM General Settings +# +# CONFIG_NXWM_LARGE_ICONS is not set +CONFIG_NXWM_CUSTOM_FONTID=y +CONFIG_NXWM_DEFAULT_FONTID=5 +CONFIG_NXWM_UNITTEST=y + +# +# Color configuration +# +# CONFIG_NXWM_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWM_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWM_CUSTOM_TEXTCOLORS is not set + +# +# Background Image +# +# CONFIG_NXWM_DISABLE_BACKGROUND_IMAGE is not set +CONFIG_NXWM_BACKGROUND_IMAGE="NXWidgets::g_nuttxBitmap160x160" + +# +# NxWM Taskbar Configuration +# + +# +# Horizontal and vertical spacing of icons in the task bar +# +CONFIG_NXWM_TASKBAR_VSPACING=4 +CONFIG_NXWM_TASKBAR_HSPACING=4 +# CONFIG_NXWM_TASKBAR_TOP is not set +# CONFIG_NXWM_TASKBAR_BOTTOM is not set +CONFIG_NXWM_TASKBAR_LEFT=y +# CONFIG_NXWM_TASKBAR_RIGHT is not set +# CONFIG_NXWM_CUSTOM_TASKBAR_WIDTH is not set +# CONFIG_NXWM_TASKBAR_ICONSCALE is not set +# CONFIG_NXWM_DISABLE_MINIMIZE is not set +# CONFIG_NXWM_TASKBAR_NO_BORDER is not set + +# +# NxWM Toolbar Configuration +# +# CONFIG_NXWM_CUSTOM_TOOLBAR_HEIGHT is not set +CONFIG_NXWM_TOOLBAR_CUSTOM_FONTID=y +CONFIG_NXWM_TOOLBAR_FONTID=5 + +# +# NxWM Application Window Configuration +# +# CONFIG_NXWM_CUSTOM_APPWINDOW_ICONS is not set + +# +# NxWM Start Window Configuration +# + +# +# Horizontal and vertical spacing of icons in the task bar +# +CONFIG_NXWM_STARTWINDOW_VSPACING=4 +CONFIG_NXWM_STARTWINDOW_HSPACING=4 +# CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set +CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MXMSGS=32 +CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 +CONFIG_NXWM_STARTWINDOW_PRIO=100 +CONFIG_NXWM_STARTWINDOW_STACKSIZE=2048 + +# +# NxTerm Window Settings +# +CONFIG_NXWM_NXTERM=y +CONFIG_NXWM_NXTERM_PRIO=100 +CONFIG_NXWM_NXTERM_STACKSIZE=2048 +# CONFIG_NXWM_NXTERM_CUSTOM_COLORS is not set +# CONFIG_NXWM_NXTERM_CUSTOM_FONTID is not set +# CONFIG_NXWM_CUSTOM_NXTERM_ICON is not set + +# +# NxWM Touchscreen Configuration +# +# CONFIG_NXWM_TOUCHSCREEN is not set + +# +# NxWM Keyboard Configuration +# +CONFIG_NXWM_KEYBOARD=y + +# +# Keyboard Device Settings +# +CONFIG_NXWM_KEYBOARD_DEVPATH="/dev/console" +# CONFIG_NXWM_KEYBOARD_USBHOST is not set +CONFIG_NXWM_KEYBOARD_SIGNO=6 +CONFIG_NXWM_KEYBOARD_BUFSIZE=16 +CONFIG_NXWM_KEYBOARD_LISTENERPRIO=120 +CONFIG_NXWM_KEYBOARD_LISTENERSTACK=2048 + +# +# NxWM Calibration Display Settings +# +CONFIG_NXWM_CALIBRATION_MARGIN=40 +# CONFIG_NXWM_CALIBRATION_CUSTOM_COLORS is not set +CONFIG_NXWM_CALIBRATION_MESSAGES=y +CONFIG_NXWM_CALIBRATION_CUSTOM_FONTID=y +CONFIG_NXWM_CALIBRATION_FONTID=5 +CONFIG_NXWM_CALIBRATION_AVERAGE=y +CONFIG_NXWM_CALIBRATION_NSAMPLES=2 +# CONFIG_NXWM_CALIBRATION_DISCARD_MINMAX is not set +# CONFIG_NXWM_CALIBRATION_ANISOTROPIC is not set +# CONFIG_NXWM_CUSTOM_CALIBRATION_ICON is not set +CONFIG_NXWM_CALIBRATION_SIGNO=5 +CONFIG_NXWM_CALIBRATION_LISTENERPRIO=100 +CONFIG_NXWM_CALIBRATION_LISTENERSTACK=2048 + +# +# NxWM Hex Calculator Display Settings +# +# CONFIG_NXWM_HEXCALCULATOR_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_HEXCALCULATOR_ICON is not set +CONFIG_NXWM_HEXCALCULATOR_CUSTOM_FONTID=y +CONFIG_NXWM_HEXCALCULATOR_FONTID=5 + +# +# NxWM Media Player Display Settings +# + +# +# Platform-specific Support +# +# CONFIG_PLATFORM_CONFIGDATA is not set + +# +# System Libraries and NSH Add-Ons +# +# CONFIG_SYSTEM_FREE is not set +# CONFIG_SYSTEM_CLE is not set +# CONFIG_SYSTEM_CUTERM is not set +# CONFIG_SYSTEM_INSTALL is not set +# CONFIG_SYSTEM_FLASH_ERASEALL is not set +# CONFIG_SYSTEM_HEX2BIN is not set +# CONFIG_SYSTEM_I2CTOOL is not set +# CONFIG_SYSTEM_HEXED is not set +# CONFIG_SYSTEM_NETDB is not set +# CONFIG_SYSTEM_RAMTEST is not set +CONFIG_READLINE_HAVE_EXTMATCH=y +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y +# CONFIG_READLINE_TABCOMPLETION is not set +# CONFIG_READLINE_CMD_HISTORY is not set +# CONFIG_SYSTEM_MDIO is not set +# CONFIG_SYSTEM_SUDOKU is not set +# CONFIG_SYSTEM_VI is not set +# CONFIG_SYSTEM_UBLOXMODEM is not set +# CONFIG_SYSTEM_ZMODEM is not set diff --git a/configs/samv71-xult/vnxwm/setenv.sh b/configs/samv71-xult/vnxwm/setenv.sh new file mode 100644 index 00000000000..c3756d2330d --- /dev/null +++ b/configs/samv71-xult/vnxwm/setenv.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# configs/samv7-xult/vnxwm/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the Atmel GCC +# toolchain under Windows. You will also have to edit this if you install +# this toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin" + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin" +# export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin" + +# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors" +# You can this free toolchain here https://launchpad.net/gcc-arm-embedded +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin" + +# This is the path to the location where I installed the devkitARM toolchain +# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/ +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" From e723fc7fd4c77acece744f640b5d2be648c0e2c1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Apr 2016 09:06:39 -0600 Subject: [PATCH 19/22] VNC: Add option to enable VNC server debug without GRAPHICS debug --- graphics/vnc/server/Kconfig | 13 ++++++++++++- graphics/vnc/server/vnc_fbdev.c | 8 ++++++++ graphics/vnc/server/vnc_negotiate.c | 8 ++++++++ graphics/vnc/server/vnc_raw.c | 8 ++++++++ graphics/vnc/server/vnc_receiver.c | 8 ++++++++ graphics/vnc/server/vnc_rre.c | 8 ++++++++ graphics/vnc/server/vnc_server.c | 8 ++++++++ graphics/vnc/server/vnc_updater.c | 9 +++++++++ 8 files changed, 69 insertions(+), 1 deletion(-) diff --git a/graphics/vnc/server/Kconfig b/graphics/vnc/server/Kconfig index 3f14b38bc2d..157b62dfc91 100644 --- a/graphics/vnc/server/Kconfig +++ b/graphics/vnc/server/Kconfig @@ -127,9 +127,20 @@ config VNCSERVER_INBUFFER_SIZE int "Input buffer size" default 80 +config VNCSERVER_DEBUG + bool "VNC Server debug" + default n + depends on DEBUG && !DEBUG_GRAPHICS + ---help--- + Normally VNC debug output is selected with DEBUG_GRAPHICS. The VNC + server server suupport this special option to enable GRAPHICS debug + output for the VNC server while GRAPHICS debug is disabled. This + provides an cleaner, less cluttered output when you only wish to + debug the VNC server versus enabling DEBUG_GRAPHICS globally. + config VNCSERVER_UPDATE_DEBUG bool "Detailed updater debug" default n - depends on DEBUG_GRAPHICS + depends on DEBUG_GRAPHICS || VNCSERVER_DEBUG endif # VNCSERVER diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index 2f98fab21bd..1df96cd9b65 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -43,6 +43,14 @@ #include #include #include + +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif #include #include diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index 5014e9a83d2..8b4f6955ed0 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -43,6 +43,14 @@ #include #include #include + +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif #include #ifdef CONFIG_NET_SOCKOPTS diff --git a/graphics/vnc/server/vnc_raw.c b/graphics/vnc/server/vnc_raw.c index 64cfee779e6..947cbfe9055 100644 --- a/graphics/vnc/server/vnc_raw.c +++ b/graphics/vnc/server/vnc_raw.c @@ -42,6 +42,14 @@ #include #include #include + +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif #include #include "vnc_server.h" diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 08a001631b6..2bc3359a50d 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -41,6 +41,14 @@ #include #include + +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif #include #ifdef CONFIG_NET_SOCKOPTS diff --git a/graphics/vnc/server/vnc_rre.c b/graphics/vnc/server/vnc_rre.c index 0ccb841f869..a216a495249 100644 --- a/graphics/vnc/server/vnc_rre.c +++ b/graphics/vnc/server/vnc_rre.c @@ -42,6 +42,14 @@ #include #include #include + +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif #include #include "vnc_server.h" diff --git a/graphics/vnc/server/vnc_server.c b/graphics/vnc/server/vnc_server.c index c33050f3032..10c0a84dd94 100644 --- a/graphics/vnc/server/vnc_server.c +++ b/graphics/vnc/server/vnc_server.c @@ -46,6 +46,14 @@ #include #include #include + +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif #include #include diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index eb76c990643..1ac9d4bf6a4 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -47,6 +47,15 @@ #include #include +#if defined(CONFIG_VNCSERVER_DEBUG) && !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +# define CONFIG_DEBUG_GRAPHICS 1 +#endif +#include + #include #include "vnc_server.h" From f3499b173adbfc89575709784a440336f2f2e0f7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Apr 2016 10:21:49 -0600 Subject: [PATCH 20/22] VNC: Fix a memory clobblering bug --- configs/samv71-xult/README.txt | 26 +++++++++----------------- include/nuttx/video/rfb.h | 4 ++-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 1efb630215b..f08af3deb4a 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -2364,28 +2364,20 @@ Configuration sub-directories 2016-04-21: I have gotten the apps/examples/nximage to work with lots issues with 16-bit RGB and verbose GRAPHICS and UPDATER debug ON. There are reliability problems and it hangs at the end of the - test. But if I turn UPDATE debug off (only), then the display - output is corrupted. I have also see hardfaults. + test. - Mostly likely, the UPDATER debug output slows the updates and - avoids some kind of race condition with the networking. Oddly, - it does not work at all if I turn off TCP write buffering. - - 2016-04-22: I added a 100 MS delay at the beginning of the - updater loop and it made no difference. This seems to eliminate - the suspected networking race condition. I am thinking now - either some data overrun or VNC protocol/timing issue? - - The default configuration now uses RGB8 which needs a lot less - SRAM for the local frame buffer and does not degrade the color + 2016-04-22: The default configuration now uses RGB8 which needs a lot + less SRAM for the local frame buffer and does not degrade the color quality in the remote display (since it is also 8 BPP). At 8 BPP, the remote display is correct even with both GRAPHICS and UPDATER debug OFF -- and there is no hang! - 2106-04-23: The NxImage example at apps/examplex/nximage. This was - selected because it is a very simple graphics test. Continued - testing, however, requires a more complex configuration. Hence, - the vnxwm configuration was created. + 2106-04-23: The NxImage test was selected because it is a very simple + graphics test. Continued testing, however, requires a more complex + configuration. Hence, the vnxwm configuration was created. + + A memory clobber error was fixed and this probably corrects some of + the reliability problems noted on 2016-04-21. vnxwm: diff --git a/include/nuttx/video/rfb.h b/include/nuttx/video/rfb.h index a8f68c45eb5..c6108715f22 100644 --- a/include/nuttx/video/rfb.h +++ b/include/nuttx/video/rfb.h @@ -370,8 +370,8 @@ struct rfb_setpixelformat_s struct rfb_setencodings_s { uint8_t msgtype; /* U8 Message type */ - uint8_t padding[3]; - uint8_t nencodings[4]; /* U32 Number of encodings */ + uint8_t padding; + uint8_t nencodings[2]; /* U32 Number of encodings */ uint8_t encodings[4]; /* S32 Encoding type, size = 4*nencodings */ }; From 47a33cbb64487525bb943e21f7413b1336a3dd68 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Apr 2016 10:22:54 -0600 Subject: [PATCH 21/22] VNC: Ignore client framebuffer updates if nothing has changed (we can does this because client requests incremental updates --- graphics/vnc/server/vnc_fbdev.c | 2 +- graphics/vnc/server/vnc_negotiate.c | 1 + graphics/vnc/server/vnc_receiver.c | 14 ++++++---- graphics/vnc/server/vnc_server.h | 9 ++++--- graphics/vnc/server/vnc_updater.c | 40 ++++++++++++++++++++++++----- 5 files changed, 51 insertions(+), 15 deletions(-) diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index 1df96cd9b65..36337cf2737 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -877,7 +877,7 @@ void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo, { /* Queue the rectangular update */ - ret = vnc_update_rectangle(session, rect); + ret = vnc_update_rectangle(session, rect, true); if (ret < 0) { gdbg("ERROR: vnc_update_rectangle failed: %d\n", ret); diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index 8b4f6955ed0..7b4bb67c1af 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -521,5 +521,6 @@ int vnc_client_pixelformat(FAR struct vnc_session_s *session, return -ENOSYS; } + session->change = true; return OK; } diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 2bc3359a50d..481f6bed0ce 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -176,6 +176,10 @@ int vnc_receiver(FAR struct vnc_session_s *session) return -errcode; } + /* REVISIT: This assertion sometimes fires when there is a client + * disconnection. + */ + DEBUGASSERT(nrecvd == 1); /* The single byte received should be the message type. Handle the @@ -218,7 +222,7 @@ int vnc_receiver(FAR struct vnc_session_s *session) case RFB_SETENCODINGS_MSG: /* SetEncodings */ { FAR struct rfb_setencodings_s *encodings; - uint32_t nencodings; + unsigned int nencodings; gvdbg("Received SetEncodings\n"); @@ -239,7 +243,7 @@ int vnc_receiver(FAR struct vnc_session_s *session) /* Read the following encodings */ encodings = (FAR struct rfb_setencodings_s *)session->inbuf; - nencodings = rfb_getbe32(encodings->nencodings); + nencodings = rfb_getbe16(encodings->nencodings); ret = vnc_read_remainder(session, nencodings * sizeof(uint32_t), @@ -291,7 +295,7 @@ int vnc_receiver(FAR struct vnc_session_s *session) rect.pt2.x = rect.pt1.x + rfb_getbe16(update->width); rect.pt2.y = rect.pt1.y + rfb_getbe16(update->height); - ret = vnc_update_rectangle(session, &rect); + ret = vnc_update_rectangle(session, &rect, false); if (ret < 0) { gdbg("ERROR: Failed to queue update: %d\n", ret); @@ -463,7 +467,7 @@ int vnc_client_encodings(FAR struct vnc_session_s *session, /* Loop for each client supported encoding */ - nencodings = rfb_getbe32(encodings->nencodings); + nencodings = rfb_getbe16(encodings->nencodings); for (i = 0; i < nencodings; i++) { /* Get the next encoding */ @@ -475,10 +479,10 @@ int vnc_client_encodings(FAR struct vnc_session_s *session, if (encoding == RFB_ENCODING_RRE) { session->rre = true; - return OK; } } + session->change = true; return OK; } diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index 077bc0d6b44..45d34b52600 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -246,14 +246,15 @@ struct vnc_session_s struct socket connect; /* Connected socket */ volatile uint8_t state; /* See enum vnc_server_e */ volatile uint8_t nwhupd; /* Number of whole screen updates queued */ + volatile bool change; /* True: Frambebuffer data change since last whole screen update */ /* Display geometry and color characteristics */ uint8_t display; /* Display number (for debug) */ volatile uint8_t colorfmt; /* Remote color format (See include/nuttx/fb.h) */ volatile uint8_t bpp; /* Remote bits per pixel */ - volatile bool bigendian; /* Remote expect data in big-endian format */ - volatile bool rre; /* Remote supports RRE encoding */ + volatile bool bigendian; /* True: Remote expect data in big-endian format */ + volatile bool rre; /* True: Remote supports RRE encoding */ FAR uint8_t *fb; /* Allocated local frame buffer */ /* VNC client input support */ @@ -450,6 +451,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session); * Input Parameters: * session - An instance of the session structure. * rect - The rectanglular region to be updated. + * change - True: Frame buffer data has changed * * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on @@ -458,7 +460,8 @@ int vnc_stop_updater(FAR struct vnc_session_s *session); ****************************************************************************/ int vnc_update_rectangle(FAR struct vnc_session_s *session, - FAR const struct nxgl_rect_s *rect); + FAR const struct nxgl_rect_s *rect, + bool change); /**************************************************************************** * Name: vnc_receiver diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index 1ac9d4bf6a4..0368e46f424 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -490,6 +490,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session) * Input Parameters: * session - An instance of the session structure. * rect - The rectanglular region to be updated. + * change - True: Frame buffer data has changed * * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on @@ -498,7 +499,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session) ****************************************************************************/ int vnc_update_rectangle(FAR struct vnc_session_s *session, - FAR const struct nxgl_rect_s *rect) + FAR const struct nxgl_rect_s *rect, bool change) { FAR struct vnc_fbupdate_s *update; struct nxgl_rect_s intersection; @@ -506,7 +507,7 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, /* Clip rectangle to the screen dimensions */ - nxgl_rectintersect(&intersection, rect, &g_wholescreen); + nxgl_rectintersect(&intersection, rect, &g_wholescreen); /* Make sure that the clipped rectangle has a area */ @@ -519,20 +520,34 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, whupd = (memcmp(&intersection, &g_wholescreen, sizeof(struct nxgl_rect_s)) == 0); - /* Ignore all updates if there is a queue whole screen update */ + /* Ignore any client update requests if there have been no changes to + * the framebuffer since the last whole screen update. + */ sched_lock(); + if (!change && !session->change) + { + /* No.. ignore the client update. We have nothing new to report. */ + + sched_unlock(); + return OK; + } + + /* Ignore all updates if there is a queued whole screen update */ + if (session->nwhupd == 0) { - /* Is this a new whole screen update */ + /* No whole screen updates in the queue. Is this a new whole + * screen update? + */ if (whupd) { + /* Yes.. Discard all of the previously queued updates */ + FAR struct vnc_fbupdate_s *curr; FAR struct vnc_fbupdate_s *next; - /* Yes.. discard all of the previously queued updates */ - updvdbg("New whole screen update...\n"); curr = (FAR struct vnc_fbupdate_s *)session->updqueue.head; @@ -545,7 +560,20 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, vnc_free_update(session, curr); } + /* One whole screen update will be queued. There have been + * no frame buffer data changes since this update was queued. + */ + session->nwhupd = 1; + session->change = false; + } + else + { + /* We are not updating the whole screen. Remember if this + * update (OR a preceding update) was due to a data change. + */ + + session->change |= change; } /* Allocate an update structure... waiting if necessary */ From 0d57612d13eb8c63637a972860864f24069a6d17 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Apr 2016 10:57:28 -0600 Subject: [PATCH 22/22] VNC: Need to handle connection closed events --- graphics/vnc/server/vnc_negotiate.c | 27 ++++++++++++++++++++++++++- graphics/vnc/server/vnc_receiver.c | 10 ++++++++-- graphics/vnc/server/vnc_server.c | 3 +++ include/nuttx/video/rfb.h | 2 +- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/graphics/vnc/server/vnc_negotiate.c b/graphics/vnc/server/vnc_negotiate.c index 7b4bb67c1af..1d7e28d8148 100644 --- a/graphics/vnc/server/vnc_negotiate.c +++ b/graphics/vnc/server/vnc_negotiate.c @@ -162,6 +162,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session) DEBUGASSERT(errcode > 0); return -errcode; } + else if (nrecvd == 0) + { + gdbg("Connection closed\n"); + return -ECONNABORTED; + } DEBUGASSERT(nrecvd == len); @@ -229,6 +234,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session) DEBUGASSERT(errcode > 0); return -errcode; } + else if (nrecvd == 0) + { + gdbg("Connection closed\n"); + return -ECONNABORTED; + } DEBUGASSERT(nrecvd == sizeof(struct rfb_selected_sectype_s)); @@ -313,6 +323,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session) DEBUGASSERT(errcode > 0); return -errcode; } + else if (nrecvd == 0) + { + gdbg("Connection closed\n"); + return -ECONNABORTED; + } DEBUGASSERT(nrecvd == sizeof(struct rfb_clientinit_s)); @@ -383,6 +398,11 @@ int vnc_negotiate(FAR struct vnc_session_s *session) DEBUGASSERT(errcode > 0); return -errcode; } + else if (nrecvd == 0) + { + gdbg("Connection closed\n"); + return -ECONNABORTED; + } else if (nrecvd != sizeof(struct rfb_setpixelformat_s)) { /* Must not be a SetPixelFormat message? */ @@ -425,8 +445,13 @@ int vnc_negotiate(FAR struct vnc_session_s *session) DEBUGASSERT(errcode > 0); return -errcode; } + else if (nrecvd == 0) + { + gdbg("Connection closed\n"); + return -ECONNABORTED; + } - if (nrecvd > 0 && encodings->msgtype == RFB_SETENCODINGS_MSG) + if (encodings->msgtype == RFB_SETENCODINGS_MSG) { DEBUGASSERT(nrecvd >= SIZEOF_RFB_SETENCODINGS_S(0)); diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index 481f6bed0ce..4f25d4931eb 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -176,10 +176,16 @@ int vnc_receiver(FAR struct vnc_session_s *session) return -errcode; } - /* REVISIT: This assertion sometimes fires when there is a client - * disconnection. + /* A return value of zero means that the connection was gracefully + * closed by the VNC client. */ + else if (nrecvd == 0) + { + gdbg("Connection closed\n", errcode); + return OK; + } + DEBUGASSERT(nrecvd == 1); /* The single byte received should be the message type. Handle the diff --git a/graphics/vnc/server/vnc_server.c b/graphics/vnc/server/vnc_server.c index 10c0a84dd94..db49b55c618 100644 --- a/graphics/vnc/server/vnc_server.c +++ b/graphics/vnc/server/vnc_server.c @@ -129,9 +129,11 @@ static void vnc_reset_session(FAR struct vnc_session_s *session, sem_reset(&session->freesem, CONFIG_VNCSERVER_NUPDATES); sem_reset(&session->queuesem, 0); + session->fb = fb; session->display = display; session->state = VNCSERVER_INITIALIZED; + session->change = true; } /**************************************************************************** @@ -344,6 +346,7 @@ int vnc_server(int argc, FAR char *argv[]) ret = vnc_receiver(session); gvdbg("Session terminated with %d\n", ret); + UNUSED(ret); /* Stop the VNC updater thread. */ diff --git a/include/nuttx/video/rfb.h b/include/nuttx/video/rfb.h index c6108715f22..0b1c13821c0 100644 --- a/include/nuttx/video/rfb.h +++ b/include/nuttx/video/rfb.h @@ -371,7 +371,7 @@ struct rfb_setencodings_s { uint8_t msgtype; /* U8 Message type */ uint8_t padding; - uint8_t nencodings[2]; /* U32 Number of encodings */ + uint8_t nencodings[2]; /* U16 Number of encodings */ uint8_t encodings[4]; /* S32 Encoding type, size = 4*nencodings */ };