Turn off LCD reading on Shenzhou board (needs some TLC before it will be usable)

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5202 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-09-28 19:24:46 +00:00
parent 8e47dd37d6
commit 343817a6fd
9 changed files with 159 additions and 36 deletions
+92 -11
View File
@@ -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++;
}