summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-04-18 02:56:15 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-04-18 02:56:15 +0000
commit9503945271e3740832c5aa4d66083b27f99420ac (patch)
treea3ead8e27254ad26ee4b47a8d5b50b96e609c957
parenteb89fdaa39dede1a8e37519ae3ec4ffa588e705c (diff)
downloadnuttx-9503945271e3740832c5aa4d66083b27f99420ac.tar.gz
nuttx-9503945271e3740832c5aa4d66083b27f99420ac.tar.bz2
nuttx-9503945271e3740832c5aa4d66083b27f99420ac.zip
Code complete for NX for LCD
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2610 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xnuttx/configs/sam3u-ek/nsh/defconfig13
-rw-r--r--nuttx/graphics/nxbe/nxbe_configure.c6
-rwxr-xr-xnuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c92
-rw-r--r--nuttx/graphics/nxglib/nxglib_copyrun.h18
-rwxr-xr-xnuttx/include/nuttx/lcd.h4
5 files changed, 55 insertions, 78 deletions
diff --git a/nuttx/configs/sam3u-ek/nsh/defconfig b/nuttx/configs/sam3u-ek/nsh/defconfig
index 48f89c554..7c36d45ab 100755
--- a/nuttx/configs/sam3u-ek/nsh/defconfig
+++ b/nuttx/configs/sam3u-ek/nsh/defconfig
@@ -87,7 +87,7 @@ CONFIG_ARCH_BOOTLOADER=n
CONFIG_ARCH_LEDS=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CALIBRATION=n
-CONFIG_ARCH_DMA=n
+CONFIG_ARCH_DMA=y
#
# Identify toolchain and linker options
@@ -100,9 +100,9 @@ CONFIG_SAM3U_BUILDROOT=y
#
# Individual subsystems can be enabled:
#
-CONFIG_SAM3U_DMA=n
+CONFIG_SAM3U_DMA=y
CONFIG_SAM3U_NAND=n
-CONFIG_SAM3U_HSMCI=n
+CONFIG_SAM3U_HSMCI=y
CONFIG_SAM3U_UART=y
CONFIG_SAM3U_USART0=n
CONFIG_SAM3U_USART1=n
@@ -316,7 +316,7 @@ CONFIG_FDCLONE_DISABLE=n
CONFIG_FDCLONE_STDIO=n
CONFIG_SDCLONE_DISABLE=y
CONFIG_NXFLAT=n
-CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKQUEUE=y
CONFIG_SCHED_WORKPRIORITY=50
CONFIG_SCHED_WORKPERIOD=(50*1000)
CONFIG_SCHED_WORKSTACKSIZE=1024
@@ -461,12 +461,15 @@ CONFIG_FS_WRITEBUFFER=n
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
+# CONFIG_SDIO_BLOCKSETUP
+# Support block setup methods
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
+CONFIG_SDIO_BLOCKSETUP=y
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
@@ -697,7 +700,7 @@ CONFIG_EXAMPLES_NSH_DISABLEBG=n
CONFIG_EXAMPLES_NSH_ROMFSETC=n
CONFIG_EXAMPLES_NSH_CONSOLE=y
CONFIG_EXAMPLES_NSH_TELNET=n
-CONFIG_EXAMPLES_NSH_ARCHINIT=n
+CONFIG_EXAMPLES_NSH_ARCHINIT=y
CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512
CONFIG_EXAMPLES_NSH_DHCPC=n
CONFIG_EXAMPLES_NSH_NOMAC=n
diff --git a/nuttx/graphics/nxbe/nxbe_configure.c b/nuttx/graphics/nxbe/nxbe_configure.c
index 527c46975..881bcd99e 100644
--- a/nuttx/graphics/nxbe/nxbe_configure.c
+++ b/nuttx/graphics/nxbe/nxbe_configure.c
@@ -78,14 +78,14 @@
*
****************************************************************************/
-int nxbe_configure(FAR struct fb_vtable_s *fb, FAR struct nxbe_state_s *be)
+int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
{
int ret;
int i;
/* Get the video controller configuration */
- ret = fb->getvideoinfo(fb, &be->vinfo);
+ ret = dev->getvideoinfo(dev, &be->vinfo);
if (ret < 0)
{
gdbg("Failed to get vinfo\n");
@@ -112,7 +112,7 @@ int nxbe_configure(FAR struct fb_vtable_s *fb, FAR struct nxbe_state_s *be)
for (i = 0; i < be->vinfo.nplanes; i++)
{
- ret = fb->getplaneinfo(fb, i, &be->plane[i].pinfo);
+ ret = dev->getplaneinfo(dev, i, &be->plane[i].pinfo);
if (ret < 0)
{
gdbg("Failed to get pinfo[%d]\n", i);
diff --git a/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c
index 8d73dcb73..893030567 100755
--- a/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c
+++ b/nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c
@@ -40,11 +40,13 @@
#include <nuttx/config.h>
#include <stdint.h>
+#include <assert.h>
#include <nuttx/lcd.h>
#include <nuttx/nxglib.h>
#include "nxglib_bitblit.h"
+#include "nxglib_copyrun.h"
/****************************************************************************
* Pre-Processor Definitions
@@ -85,89 +87,55 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
unsigned int srcstride)
{
FAR const uint8_t *sline;
- unsigned int width;
- unsigned int rows;
-
+ unsigned int ncols;
+ unsigned int row;
+ unsigned int xoffset;
#if NXGLIB_BITSPERPIXEL < 8
- FAR const uint8_t *sptr;
- FAR uint8_t *dptr;
- uint8_t leadmask;
- uint8_t tailmask;
- uint8_t mask;
- int lnlen;
+ unsigned int remainder;
#endif
/* Get the dimensions of the rectange to fill: width in pixels,
* height in rows
*/
- width = dest->pt2.x - dest->pt1.x + 1;
- rows = dest->pt2.y - dest->pt1.y + 1;
+ ncols = dest->pt2.x - dest->pt1.x + 1;
-#if NXGLIB_BITSPERPIXEL < 8
-# ifdef CONFIG_NX_PACKEDMSFIRST
+ /* Set up to copy the image */
- /* Get the mask for pixels that are ordered so that they pack from the
- * MS byte down.
- */
-
- leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x)));
- tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x-1)));
-# else
- /* Get the mask for pixels that are ordered so that they pack from the
- * LS byte up.
- */
-
- leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x)));
- tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x-1)));
-# endif
+ xoffset = dest->pt1.x - origin->x;
+ sline = (const uint8_t*)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride;
+#if NXGLIB_BITSPERPIXEL < 8
+ remainder = NXGL_REMAINDERX(xoffset);
#endif
- /* Then copy the image */
+ /* Copy the image, one row at a time */
- sline = (const uint8_t*)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride;
- dline = pinfo->fbmem + dest->pt1.y * deststride + NXGL_SCALEX(dest->pt1.x);
-
- while (rows--)
+ for (row = dest->pt1.y; row < dest->pt2.y; row++)
{
#if NXGLIB_BITSPERPIXEL < 8
- /* Handle masking of the fractional initial byte */
-
- mask = leadmask;
- sptr = sline;
- dptr = dline;
- lnlen = width;
+ /* if the source pixel is not aligned with a byte boundary, then we will
+ * need to copy the image data to the run buffer first.
+ */
- if (lnlen > 1 && mask)
+ if (remainder != 0)
{
- dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
- mask = 0xff;
- dptr++;
- sptr++;
- lnlen--;
+ NXGL_FUNCNAME(nxgl_copyrun,NXGLIB_SUFFIX)(sline, pinfo->buffer, remainder, ncols);
+ (void)pinfo->putrun(row, dest->pt1.x, pinfo->buffer, ncols);
}
-
- /* Handle masking of the fractional final byte */
-
- mask &= tailmask;
- if (lnlen > 0 && mask)
+ else
+#endif
{
- dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask);
- lnlen--;
- }
+ /* The pixel data is byte aligned. Copy the image data directly from
+ * the image memory.
+ */
- /* Handle all of the unmasked bytes in-between */
-
- if (lnlen > 0)
- {
- NXGL_MEMCPY(dptr, sptr, lnlen);
+ (void)pinfo->putrun(row, dest->pt1.x, sline, ncols);
}
-#else
- /* Copy the whole line */
- NXGL_MEMCPY((NXGL_PIXEL_T*)dline, (NXGL_PIXEL_T*)sline, width);
-#endif
- dline += deststride;
+ /* Then adjust the source pointer to refer to the next line in the source
+ * image.
+ */
+
sline += srcstride;
}
}
diff --git a/nuttx/graphics/nxglib/nxglib_copyrun.h b/nuttx/graphics/nxglib/nxglib_copyrun.h
index 500d2fb75..b97372bf7 100644
--- a/nuttx/graphics/nxglib/nxglib_copyrun.h
+++ b/nuttx/graphics/nxglib/nxglib_copyrun.h
@@ -79,10 +79,11 @@
#if NXGLIB_BITSPERPIXEL == 1
static inline void
nxgl_copyrun_1bpp(FAR const uint8_t *src, FAR uint8_t *dest,
- unsigned int inbit, size_t npixels)
+ unsigned int remainder, size_t npixels)
{
uint8_t indata;
uint8_t outdata;
+ uint8_t nextdata;
unsigned int outpixels = 0;
DEBUGASSERT(remainder > 0 && remainder < 8);
@@ -166,10 +167,11 @@ nxgl_copyrun_1bpp(FAR const uint8_t *src, FAR uint8_t *dest,
#elif NXGLIB_BITSPERPIXEL == 2
static inline void
nxgl_copyrun_2bpp(FAR const uint8_t *src, FAR uint8_t *dest,
- unsigned int inbit, size_t npixels)
+ unsigned int remainder, size_t npixels)
{
uint8_t indata;
uint8_t outdata;
+ uint8_t nextdata;
unsigned int outpixels = 0;
unsigned int shift;
@@ -255,10 +257,11 @@ nxgl_copyrun_2bpp(FAR const uint8_t *src, FAR uint8_t *dest,
#elif NXGLIB_BITSPERPIXEL == 4
static inline void
nxgl_copyrun_4bpp(FAR const uint8_t *src, FAR uint8_t *dest,
- unsigned int inbit, size_t npixels)
+ unsigned int remainder, size_t npixels)
{
uint8_t indata;
uint8_t outdata;
+ uint8_t nextdata;
unsigned int outpixels = 0;
DEBUGASSERT(remainder == 1);
@@ -269,7 +272,6 @@ nxgl_copyrun_4bpp(FAR const uint8_t *src, FAR uint8_t *dest,
*/
indata = *src++;
- shift = (remainder << 1);
#ifdef CONFIG_NX_PACKEDMSFIRST
/* If CONFIG_NX_PACKEDMSFIRST is defined, then bits 0-3
@@ -317,8 +319,8 @@ nxgl_copyrun_4bpp(FAR const uint8_t *src, FAR uint8_t *dest,
* src = BBBB CCCC - nextdata = CCCC xxxx
*/
- outdata |= (indata >> 4);
- nextdata = (indata << 4);
+ outdata |= (indata >> 4);
+ nextdata = (indata << 4);
#else
/* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits 0-(remainder-1)
* are carried over from that last pass through the loop (or are
@@ -328,8 +330,8 @@ nxgl_copyrun_4bpp(FAR const uint8_t *src, FAR uint8_t *dest,
* src = CCCC CCBB - nextdata = xxCC CCCC
*/
- outdata |= (indata << 4);
- nextdata = (indata >> 4);
+ outdata |= (indata << 4);
+ nextdata = (indata >> 4);
#endif
/* Transfer the byte to the run buffer */
diff --git a/nuttx/include/nuttx/lcd.h b/nuttx/include/nuttx/lcd.h
index ab93511ee..29059c6ea 100755
--- a/nuttx/include/nuttx/lcd.h
+++ b/nuttx/include/nuttx/lcd.h
@@ -93,6 +93,10 @@ struct lcd_planeinfo_s
* The size of the allocated run buffer must therefor be at least
* (bpp * xres / 8). Actual alignment of the buffer must conform to the
* bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
*/
uint8_t *buffer;