From f5fe5b29490d863ea78f4f16f876f08babd6d8a5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 28 Sep 2012 19:24:46 +0000 Subject: Turn off LCD reading on Shenzhou board (needs some TLC before it will be usable) git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5202 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/ChangeLog.txt | 2 + NxWidgets/Kconfig | 11 +++- apps/ChangeLog.txt | 2 + apps/NxWidgets/Kconfig | 11 +++- nuttx/ChangeLog | 8 +++ nuttx/configs/shenzhou/README.txt | 42 +++++++++---- nuttx/configs/shenzhou/nxwm/defconfig | 6 +- nuttx/configs/shenzhou/src/up_ssd1289.c | 10 ++-- nuttx/drivers/lcd/ssd1289.c | 103 ++++++++++++++++++++++++++++---- 9 files changed, 159 insertions(+), 36 deletions(-) diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index 840c0640b..03b416001 100644 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -168,3 +168,5 @@ exactly sure how to do that. * libnxwidgets/Makefile and NxWidgets/nxwm/Makefile: Need updates for consistency with recent changes to NuttX build system (>= 6.22) +* Kconfig: Add option to turn on the memory monitor feature of the + NxWidgets/NxWM unit tests. diff --git a/NxWidgets/Kconfig b/NxWidgets/Kconfig index 1d7852507..6befd1ace 100644 --- a/NxWidgets/Kconfig +++ b/NxWidgets/Kconfig @@ -3,7 +3,7 @@ # see misc/tools/kconfig-language.txt. # -menuconfig NXWIDGETS +config NXWIDGETS bool "Enable NxWidgets" default n depends on NX && HAVE_CXX @@ -201,9 +201,16 @@ config NXWIDGETS_CURSORCONTROL_SIZE of cursor controls that can between entered by NX polling cycles without losing data. Default: 4 +config NXWIDGET_MEMMONITOR + bool "Memory Usage Monitor" + default n + ---help--- + Enable memory usage monitor instrumentation. This feature is only + used by the NxWidget/NxWM unit tests. + endif -menuconfig NXWM +config NXWM bool "Enable NxWM" default n depends on NXWIDGETS && NX_MULTIUSER diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 64a923559..a14f51323 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -346,3 +346,5 @@ possible to configure NxWidgets/NxWM without too much trouble (with the tradeoff being a kind ugly structure and some maintenance issues). * apps/examples/Make.defs: Missing support for apps/examples/watchdog. + * apps/NxWidgets/Kconfig: Add option to turn on the memory monitor + feature of the NxWidgets/NxWM unit tests. diff --git a/apps/NxWidgets/Kconfig b/apps/NxWidgets/Kconfig index 1d7852507..6befd1ace 100644 --- a/apps/NxWidgets/Kconfig +++ b/apps/NxWidgets/Kconfig @@ -3,7 +3,7 @@ # see misc/tools/kconfig-language.txt. # -menuconfig NXWIDGETS +config NXWIDGETS bool "Enable NxWidgets" default n depends on NX && HAVE_CXX @@ -201,9 +201,16 @@ config NXWIDGETS_CURSORCONTROL_SIZE of cursor controls that can between entered by NX polling cycles without losing data. Default: 4 +config NXWIDGET_MEMMONITOR + bool "Memory Usage Monitor" + default n + ---help--- + Enable memory usage monitor instrumentation. This feature is only + used by the NxWidget/NxWM unit tests. + endif -menuconfig NXWM +config NXWM bool "Enable NxWM" default n depends on NXWIDGETS && NX_MULTIUSER diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 48ebddfca..70c31dcee 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3438,3 +3438,11 @@ * arch/arm/src/stm32/stm32_gpio.c: Add missing logic to set bit for SPI3 remap. This fixes the XPT2046 touchscreen driver using drivers/input/ads7843.c + * configs/shenzhou/src/up_ssd1289.c: Fix naming error in + conditional compilation. + * configs/shenzhou/nxwm/defconfig: Disable reading from the LCD. + This does not work. The hardware and the driver support the + capability, but there is some bug that causes memory corruption. + The work around for now: Just disable reading from the LCD. + * drivers/lcd/ssd1289.c: Add some logic to reduce the amount of + output when CONFIG_DEBUG_LCD is enabled. diff --git a/nuttx/configs/shenzhou/README.txt b/nuttx/configs/shenzhou/README.txt index 9c358c5a5..515b487e7 100644 --- a/nuttx/configs/shenzhou/README.txt +++ b/nuttx/configs/shenzhou/README.txt @@ -702,11 +702,11 @@ Where is one of the following: This is a special configuration setup for the NxWM window manager UnitTest. The NxWM window manager can be found here: - trunk/NxWidgets/nxwm + nuttx-code/NxWidgets/nxwm The NxWM unit test can be found at: - trunk/NxWidgets/UnitTests/nxwm + nuttx-code/NxWidgets/UnitTests/nxwm NOTE: JP6 selects between the touchscreen interrupt and the MII interrupt. It should be positioned 1-2 to enable the touchscreen @@ -714,13 +714,13 @@ Where is one of the following: Documentation for installing the NxWM unit test can be found here: - trunk/NxWidgets/UnitTests/README.txt + nuttx-code/NxWidgets/UnitTests/README.txt Here is the quick summary of the build steps: 1. Intall the nxwm configuration - $ cd ~/nuttx/trunk/nuttx/tools + $ cd ~/nuttx/nuttx-code/tools $ ./configure.sh shenzhou/nxwm 2. Make the build context (only) @@ -732,25 +732,41 @@ Where is one of the following: 3. Install the nxwm unit test - $ cd ~/nuttx/trunk/NxWidgets - $ tools/install.sh ~/nuttx/trunk/apps nxwm + $ cd ~/nuttx/nuttx-code/NxWidgets + $ tools/install.sh ~/nuttx/nuttx-code/apps nxwm Creating symbolic link - - To ~/nuttx/trunk/NxWidgets/UnitTests/nxwm - - At ~/nuttx/trunk/apps/external + - To ~/nuttx/nuttx-code/NxWidgets/UnitTests/nxwm + - At ~/nuttx/nuttx-code/apps/external 4. Build the NxWidgets library - $ cd ~/nuttx/trunk/NxWidgets/libnxwidgets - $ make TOPDIR=~/nuttx/trunk/nuttx + $ cd ~/nuttx/nuttx-code/NxWidgets/libnxwidgets + $ make TOPDIR=~/nuttx/nuttx-code ... 5. Build the NxWM library - $ cd ~/nuttx/trunk/NxWidgets/nxwm - $ make TOPDIR=~//nuttx/trunk/nuttx + $ cd ~/nuttx/nuttx-code/NxWidgets/nxwm + $ make TOPDIR=~/nuttx/nuttx-code ... 6. Built NuttX with the installed unit test as the application - $ cd ~/nuttx/trunk/nuttx + $ cd ~/nuttx/nuttx-code $ make + + NOTE: Reading from the LCD is not currently supported by this + configuration. The hardware will support reading from the LCD + and drivers/lcd/ssd1289.c also supports reading from the LCD. + This limits some graphics capabilities. + + If you enable reading from the LCD, you will see some memory + corruption. If you get inspired to debug this problem, you can + turn the LCD read functionality back on by setting: + + -CONFIG_LCD_NOGETRUN=y + +# CONFIG_LCD_NOGETRUN is not set + + -CONFIG_NX_WRITEONLY=y + +# CONFIG_NX_WRITEONLY is not set + \ No newline at end of file diff --git a/nuttx/configs/shenzhou/nxwm/defconfig b/nuttx/configs/shenzhou/nxwm/defconfig index 811ba0266..4b84144b6 100644 --- a/nuttx/configs/shenzhou/nxwm/defconfig +++ b/nuttx/configs/shenzhou/nxwm/defconfig @@ -197,7 +197,6 @@ CONFIG_STM32_PHYSR_100FD=0x8000 CONFIG_STM32_RMII=y CONFIG_STM32_RMII_MCO=y # CONFIG_STM32_RMII_EXTCLK is not set -# CONFIG_STM32_ETHMAC_REGDEBUG is not set # # USB Host Configuration @@ -367,7 +366,7 @@ CONFIG_ADS7843E_THRESHX=39 CONFIG_ADS7843E_THRESHY=51 # CONFIG_INPUT_STMPE811 is not set CONFIG_LCD=y -# CONFIG_LCD_NOGETRUN is not set +CONFIG_LCD_NOGETRUN=y CONFIG_LCD_MAXCONTRAST=1 CONFIG_LCD_MAXPOWER=1 # CONFIG_LCD_P14201 is not set @@ -487,7 +486,7 @@ CONFIG_FAT_MAXFNAME=32 CONFIG_NX=y CONFIG_NX_LCDDRIVER=y CONFIG_NX_NPLANES=1 -# CONFIG_NX_WRITEONLY is not set +CONFIG_NX_WRITEONLY=y # # Supported Pixel Depths @@ -1075,6 +1074,7 @@ 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 # diff --git a/nuttx/configs/shenzhou/src/up_ssd1289.c b/nuttx/configs/shenzhou/src/up_ssd1289.c index 00e0ac0dd..50a99bddf 100644 --- a/nuttx/configs/shenzhou/src/up_ssd1289.c +++ b/nuttx/configs/shenzhou/src/up_ssd1289.c @@ -122,7 +122,7 @@ static void stm32_lcdshow(FAR struct stm32_lower_s *priv, FAR const char *msg); #endif static void stm32_wrdata(FAR struct stm32_lower_s *priv, uint16_t data); -#ifndef CONFIG_SSD1289_WRONLY +#ifndef CONFIG_LCD_NOGETRUN static inline uint16_t stm32_rddata(FAR struct stm32_lower_s *priv); #endif @@ -131,7 +131,7 @@ static inline uint16_t stm32_rddata(FAR struct stm32_lower_s *priv); static void stm32_select(FAR struct ssd1289_lcd_s *dev); static void stm32_deselect(FAR struct ssd1289_lcd_s *dev); static void stm32_index(FAR struct ssd1289_lcd_s *dev, uint8_t index); -#ifndef CONFIG_SSD1289_WRONLY +#ifndef CONFIG_LCD_NOGETRUN static uint16_t stm32_read(FAR struct ssd1289_lcd_s *dev); #endif static void stm32_write(FAR struct ssd1289_lcd_s *dev, uint16_t data); @@ -253,7 +253,7 @@ static struct stm32_lower_s g_lcdlower = .select = stm32_select, .deselect = stm32_deselect, .index = stm32_index, -#ifndef CONFIG_SSD1289_WRONLY +#ifndef CONFIG_LCD_NOGETRUN .read = stm32_read, #endif .write = stm32_write, @@ -326,7 +326,7 @@ static void stm32_wrdata(FAR struct stm32_lower_s *priv, uint16_t data) * ************************************************************************************/ -#ifndef CONFIG_SSD1289_WRONLY +#ifndef CONFIG_LCD_NOGETRUN static inline uint16_t stm32_rddata(FAR struct stm32_lower_s *priv) { uint16_t regval; @@ -407,7 +407,7 @@ static void stm32_index(FAR struct ssd1289_lcd_s *dev, uint8_t index) * ************************************************************************************/ -#ifndef CONFIG_SSD1289_WRONLY +#ifndef CONFIG_LCD_NOGETRUN static uint16_t stm32_read(FAR struct ssd1289_lcd_s *dev) { FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)dev; diff --git a/nuttx/drivers/lcd/ssd1289.c b/nuttx/drivers/lcd/ssd1289.c index f5f11b87d..e42b5bded 100644 --- a/nuttx/drivers/lcd/ssd1289.c +++ b/nuttx/drivers/lcd/ssd1289.c @@ -229,8 +229,8 @@ /* Debug ******************************************************************************/ #ifdef CONFIG_DEBUG_LCD -# define lcddbg dbg -# define lcdvdbg vdbg +# define lcddbg dbg +# define lcdvdbg vdbg #else # define lcddbg(x...) # define lcdvdbg(x...) @@ -253,6 +253,16 @@ struct ssd1289_dev_s FAR struct ssd1289_lcd_s *lcd; /* The contained platform-specific, LCD interface */ uint8_t power; /* Current power setting */ + /* These fields simplify and reduce debug output */ + +#ifdef CONFIG_DEBUG_LCD + bool put; /* Last raster operation was a putrun */ + fb_coord_t firstrow; /* First row of the run */ + fb_coord_t lastrow; /* Last row of the run */ + fb_coord_t col; /* Column of the run */ + size_t npixels; /* Length of the run */ +#endif + /* This is working memory allocated by the LCD driver for each LCD device * and for each color plane. This memory will hold one raster line of data. * The size of the allocated run buffer must therefore be at least @@ -287,6 +297,19 @@ static void ssd1289_setcursor(FAR struct ssd1289_lcd_s *lcd, uint16_t column, /* LCD Data Transfer Methods */ +#if 0 /* Sometimes useful */ +static void ssd1289_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels); +#else +# define ssd1289_dumprun(m,r,n) +#endif + +#ifdef CONFIG_DEBUG_LCD +static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row, + fb_coord_t col, size_t npixels, bool put); +#else +# define ssd1289_showrun(p,r,c,n,b) +#endif + static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, size_t npixels); static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, @@ -488,6 +511,64 @@ static void ssd1289_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixe } #endif +/************************************************************************************** + * Name: ssd1289_showrun + * + * Description: + * When LCD debug is enabled, try to reduce then amount of ouptut data generated by + * ssd1289_putrun and ssd1289_getrun + * + **************************************************************************************/ + +#ifdef CONFIG_DEBUG_LCD +static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row, + fb_coord_t col, size_t npixels, bool put) +{ + fb_coord_t nextrow = priv->lastrow + 1; + + /* Has anything changed (other than the row is the next row in the sequence)? */ + + if (put == priv->put && row == nextrow && col == priv->col && + npixels == priv->npixels) + { + /* No, just update the last row */ + + priv->lastrow = nextrow; + } + else + { + /* Yes... then this is the end of the preceding sequence. Output the last run + * (if there were more than one run in the sequence). + */ + + if (priv->firstrow != priv->lastrow) + { + lcddbg("...\n"); + lcddbg("%s row: %d col: %d npixels: %d\n", + priv->put ? "PUT" : "GET", + priv->lastrow, priv->col, priv->npixels); + } + + /* And we are starting a new sequence. Output the first run of the + * new sequence + */ + + lcddbg("%s row: %d col: %d npixels: %d\n", + put ? "PUT" : "GET", row, col, npixels); + + /* And save information about the run so that we can detect continuations + * of the sequence. + */ + + priv->put = put; + priv->firstrow = row; + priv->lastrow = row; + priv->col = col; + priv->npixels = npixels; + } +} +#endif + /************************************************************************************** * Name: ssd1289_putrun * @@ -512,7 +593,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf /* Buffer must be provided and aligned to a 16-bit address boundary */ - lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels); + ssd1289_showrun(priv, row, col, npixels, true); DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0); /* Select the LCD */ @@ -536,7 +617,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf ssd1289_gramselect(lcd); ssd1289_gramwrite(lcd, *src); - /* Increment to next column */ + /* Increment to the next column */ src++; col++; @@ -581,7 +662,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf ssd1289_gramselect(lcd); ssd1289_gramwrite(lcd, *src); - /* Increment to next column */ + /* Increment to the next column */ src++; col--; @@ -604,7 +685,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf ssd1289_gramselect(lcd); ssd1289_gramwrite(lcd, *src); - /* Decrement to next column */ + /* Decrement to the next column */ src++; col++; @@ -632,7 +713,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf **************************************************************************************/ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, - size_t npixels) + size_t npixels) { #ifndef CONFIG_LCD_NOGETRUN FAR struct ssd1289_dev_s *priv = &g_lcddev; @@ -643,7 +724,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, /* Buffer must be provided and aligned to a 16-bit address boundary */ - lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels); + ssd1289_showrun(priv, row, col, npixels, false); DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0); /* Select the LCD */ @@ -666,7 +747,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, ssd1289_readsetup(lcd, &accum); *dest++ = ssd1289_gramread(lcd, &accum); - /* Increment to next column */ + /* Increment to the next column */ col++; } @@ -715,7 +796,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, ssd1289_readsetup(lcd, &accum); *dest++ = ssd1289_gramread(lcd, &accum); - /* Increment to next column */ + /* Increment to the next column */ col--; } @@ -738,7 +819,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, ssd1289_readsetup(lcd, &accum); *dest++ = ssd1289_gramread(lcd, &accum); - /* Decrement to next column */ + /* Decrement to the next column */ col++; } -- cgit v1.2.3