summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h16
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c416
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h115
-rw-r--r--nuttx/configs/open1788/include/board.h76
-rw-r--r--nuttx/include/nuttx/fb.h17
5 files changed, 618 insertions, 22 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h
index 7efa24ca9..87198c624 100644
--- a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h
+++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h
@@ -305,8 +305,8 @@
#define GPIO_QEI_IDX (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
#define GPIO_MCPWM_MCFB2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
#define GPIO_SSP0_MOSI_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
-#define GPIO_LCD_VD10_14_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
-#define GPIO_LCD_VD10_14_2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
+#define GPIO_LCD_VD10_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
+#define GPIO_LCD_VD14_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24)
#define GPIO_USB1_LS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25)
#define GPIO_USB1_HSTEN (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25)
@@ -336,7 +336,7 @@
#define GPIO_MAT0p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28)
#define GPIO_MCPWM_MC2A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28)
#define GPIO_SSP0_SSEL_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28)
-#define GPIO_LCD_VD14 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28)
+#define GPIO_LCD_VD14_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28)
#define GPIO_LCD_VD22 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28)
#define GPIO_USB1_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29)
@@ -416,7 +416,7 @@
#define GPIO_UART4_RXD_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9)
#define GPIO_ENET_MDIO_2 (GPIO_ALT4 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN9)
#define GPIO_LCD_VD3_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9)
-#define GPIO_LCD_VD7 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9)
+#define GPIO_LCD_VD7_2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9)
#define GPIO_EINT0_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10)
#define GPIO_NMI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10)
@@ -431,7 +431,7 @@
#define GPIO_I2S_TXWS_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
#define GPIO_LCD_VD4_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
#define GPIO_LCD_VD3_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
-#define GPIO_LCD_VD8 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
+#define GPIO_LCD_VD8_3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
#define GPIO_LCD_VD18 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
#define GPIO_EINT3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13)
@@ -614,16 +614,16 @@
#define GPIO_UART3_TXD_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28)
#define GPIO_MAT2p0_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28)
#define GPIO_LCD_VD6_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28)
-#define GPIO_LCD_VD10_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28)
+#define GPIO_LCD_VD10_3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28)
#define GPIO_LCD_VD2_2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28)
#define GPIO_EMC_BLS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
#define GPIO_UART3_RXD_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
#define GPIO_MAT2p1_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
#define GPIO_I2C2_SCL_3 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
-#define GPIO_LCD_VD7_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
+#define GPIO_LCD_VD7_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
#define GPIO_LCD_VD11_3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
-#define GPIO_LCD_VD2_3 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
+#define GPIO_LCD_VD3_3 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29)
#define GPIO_EMC_CS0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN30)
#define GPIO_EMC_CS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN31)
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
new file mode 100644
index 000000000..0fdae36e7
--- /dev/null
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
@@ -0,0 +1,416 @@
+/****************************************************************************
+ * arch/arm/src//lpc17xx/lpc17_lcd.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/fb.h>
+#include "lpc17_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Framebuffer characteristics in bytes */
+
+#define FB_WIDTH ((CONFIG_LPC17_LCD_HWIDTH * CONFIG_LPC17_LCD_BPP + 7) / 8)
+#define FB_SIZE (FB_WIDTH * CONFIG_LPC17_LCD_VHEIGHT)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/* Get information about the video controller configuration and the
+ * configuration of each color plane.
+ */
+
+static int lpc17_getvideoinfo(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_videoinfo_s *vinfo);
+static int lpc17_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
+ FAR struct fb_planeinfo_s *pinfo);
+
+/* The following is provided only if the video hardware supports RGB color
+ * mapping
+ */
+
+#ifdef CONFIG_FB_CMAP
+static int lpc17_getcmap(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_cmap_s *cmap);
+static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_cmap_s *cmap);
+#endif
+
+/* The following is provided only if the video hardware supports a hardware
+ * cursor
+ */
+
+#ifdef CONFIG_FB_HWCURSOR
+static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_cursorattrib_s *attrib);
+static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_setcursor_s *setttings);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This structure describes the simulated video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{
+ .fmt = FB_FMT,
+ .xres = CONFIG_LPC17_LCD_HWIDTH,
+ .yres = CONFIG_LPC17_LCD_VHEIGHT,
+ .nplanes = 1,
+};
+
+/* This structure describes the single, simulated color plane */
+
+static const struct fb_planeinfo_s g_planeinfo =
+{
+ .fbmem = (FAR void *)LCD_VRAM_BASE,
+ .fblen = FB_SIZE,
+ .stride = FB_WIDTH,
+ .bpp = CONFIG_LPC17_LCD_BPP,
+};
+
+/* Current cursor position */
+
+#ifdef CONFIG_FB_HWCURSOR
+static struct fb_cursorpos_s g_cpos;
+
+/* Current cursor size */
+
+#ifdef CONFIG_FB_HWCURSORSIZE
+static struct fb_cursorsize_s g_csize;
+#endif
+#endif
+
+/* The framebuffer object -- There is no private state information in this simple
+ * framebuffer simulation.
+ */
+
+struct fb_vtable_s g_fbobject =
+{
+ .getvideoinfo = lpc17_getvideoinfo,
+ .getplaneinfo = lpc17_getplaneinfo,
+#ifdef CONFIG_FB_CMAP
+ .getcmap = lpc17_getcmap,
+ .putcmap = lpc17_putcmap,
+#endif
+#ifdef CONFIG_FB_HWCURSOR
+ .getcursor = lpc17_getcursor,
+ .setcursor = lpc17_setcursor,
+#endif
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc17_getvideoinfo
+ ****************************************************************************/
+
+static int lpc17_getvideoinfo(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ dbg("vtable=%p vinfo=%p\n", vtable, vinfo);
+ if (vtable && vinfo)
+ {
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+ }
+
+ dbg("Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: lpc17_getplaneinfo
+ ****************************************************************************/
+
+static int lpc17_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
+ FAR struct fb_planeinfo_s *pinfo)
+{
+ dbg("vtable=%p planeno=%d pinfo=%p\n", vtable, planeno, pinfo);
+ if (vtable && planeno == 0 && pinfo)
+ {
+ memcpy(pinfo, &g_planeinfo, sizeof(struct fb_planeinfo_s));
+ return OK;
+ }
+
+ dbg("Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: lpc17_getcmap
+ ****************************************************************************/
+
+#ifdef CONFIG_FB_CMAP
+static int lpc17_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap)
+{
+ int len;
+ int i;
+
+ dbg("vtable=%p cmap=%p len=%d\n", vtable, cmap, cmap->len);
+ if (vtable && cmap)
+ {
+ for (i = cmap->first, len = 0; i < 256 && len < cmap->len; i++, len++)
+ {
+ cmap->red[i] = i;
+ cmap->green[i] = i;
+ cmap->blue[i] = i;
+#ifdef CONFIG_FB_TRANSPARENCY
+ cmap->transp[i] = i;
+#endif
+ }
+
+ cmap->len = len;
+ return OK;
+ }
+
+ dbg("Returning EINVAL\n");
+ return -EINVAL;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc17_putcmap
+ ****************************************************************************/
+
+#ifdef CONFIG_FB_CMAP
+static int lpc17_putcmap(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap)
+{
+ dbg("vtable=%p cmap=%p len=%d\n", vtable, cmap, cmap->len);
+ if (vtable && cmap)
+ {
+ return OK;
+ }
+
+ dbg("Returning EINVAL\n");
+ return -EINVAL;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc17_getcursor
+ ****************************************************************************/
+
+#ifdef CONFIG_FB_HWCURSOR
+static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_cursorattrib_s *attrib)
+{
+ dbg("vtable=%p attrib=%p\n", vtable, attrib);
+ if (vtable && attrib)
+ {
+#ifdef CONFIG_FB_HWCURSORIMAGE
+ attrib->fmt = FB_FMT;
+#endif
+ dbg("pos: (x=%d, y=%d)\n", g_cpos.x, g_cpos.y);
+ attrib->pos = g_cpos;
+#ifdef CONFIG_FB_HWCURSORSIZE
+ attrib->mxsize.h = CONFIG_LPC17_LCD_VHEIGHT;
+ attrib->mxsize.w = CONFIG_LPC17_LCD_HWIDTH;
+ dbg("size: (h=%d, w=%d)\n", g_csize.h, g_csize.w);
+ attrib->size = g_csize;
+#endif
+ return OK;
+ }
+
+ dbg("Returning EINVAL\n");
+ return -EINVAL;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc17_setcursor
+ ****************************************************************************/
+
+#ifdef CONFIG_FB_HWCURSOR
+static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_setcursor_s *setttings)
+{
+ dbg("vtable=%p setttings=%p\n", vtable, setttings);
+ if (vtable && setttings)
+ {
+ dbg("flags: %02x\n", settings->flags);
+ if ((flags & FB_CUR_SETPOSITION) != 0)
+ {
+ g_cpos = settings->pos;
+ dbg("pos: (h:%d, w:%d)\n", g_cpos.x, g_cpos.y);
+ }
+#ifdef CONFIG_FB_HWCURSORSIZE
+ if ((flags & FB_CUR_SETSIZE) != 0)
+ {
+ g_csize = settings->size;
+ dbg("size: (h:%d, w:%d)\n", g_csize.h, g_csize.w);
+ }
+#endif
+#ifdef CONFIG_FB_HWCURSORIMAGE
+ if ((flags & FB_CUR_SETIMAGE) != 0)
+ {
+ dbg("image: (h:%d, w:%d) @ %p\n",
+ settings->img.height, settings->img.width, settings->img.image);
+ }
+#endif
+ return OK;
+ }
+
+ dbg("Returning EINVAL\n");
+ return -EINVAL;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc17_fbinitialize
+ *
+ * Description:
+ * Initialize the framebuffer video hardware
+ *
+ ****************************************************************************/
+
+int up_fbinitialize(void)
+{
+ /* Disable LCD controller */
+#warning "Missing logioc"
+
+ /* Configure pins */
+ /* R */
+
+ lpc17_configgpio(GPIO_LCD_VD0);
+ lpc17_configgpio(GPIO_LCD_VD1);
+ lpc17_configgpio(GPIO_LCD_VD2);
+ lpc17_configgpio(GPIO_LCD_VD3);
+ lpc17_configgpio(GPIO_LCD_VD4);
+ lpc17_configgpio(GPIO_LCD_VD5);
+ lpc17_configgpio(GPIO_LCD_VD6);
+ lpc17_configgpio(GPIO_LCD_VD7);
+
+ /* G */
+
+ lpc17_configgpio(GPIO_LCD_VD8);
+ lpc17_configgpio(GPIO_LCD_VD9);
+ lpc17_configgpio(GPIO_LCD_VD10);
+ lpc17_configgpio(GPIO_LCD_VD11);
+ lpc17_configgpio(GPIO_LCD_VD12);
+ lpc17_configgpio(GPIO_LCD_VD13);
+ lpc17_configgpio(GPIO_LCD_VD14);
+ lpc17_configgpio(GPIO_LCD_VD15);
+
+ /* B */
+
+ lpc17_configgpio(GPIO_LCD_VD16);
+ lpc17_configgpio(GPIO_LCD_VD17);
+ lpc17_configgpio(GPIO_LCD_VD18);
+ lpc17_configgpio(GPIO_LCD_VD19);
+ lpc17_configgpio(GPIO_LCD_VD20);
+ lpc17_configgpio(GPIO_LCD_VD21);
+ lpc17_configgpio(GPIO_LCD_VD22);
+ lpc17_configgpio(GPIO_LCD_VD23);
+
+ /* Other pins */
+
+ lpc17_configgpio(GPIO_LCD_DCLK);
+ lpc17_configgpio(GPIO_LCD_LP);
+ lpc17_configgpio(GPIO_LCD_FP);
+ lpc17_configgpio(GPIO_LCD_ENABM);
+ lpc17_configgpio(GPIO_LCD_PWR);
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc17_fbgetvplane
+ *
+ * Description:
+ * Return a a reference to the framebuffer object for the specified video
+ * plane.
+ *
+ * Input parameters:
+ * None
+ *
+ * Returned value:
+ * Reference to the framebuffer object (NULL on failure)
+ *
+ ***************************************************************************/
+
+FAR struct fb_vtable_s *up_fbgetvplane(int vplane)
+{
+ if (vplane == 0)
+ {
+ return &g_fbobject;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/****************************************************************************
+ * Name: lpc17_fbinitialize
+ *
+ * Description:
+ * Unitialize the framebuffer support
+ *
+ ****************************************************************************/
+
+void fb_uninitialize(void)
+{
+ return OK;
+}
+
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h
new file mode 100644
index 000000000..e86e83dfa
--- /dev/null
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx/lpc17_lcd.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * 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 __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H
+#define __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include "chip/lpc17_lcd.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration */
+
+#ifndef CONFIG_LPC17_LCD_REFRESH_FREQ
+# define CONFIG_LPC17_LCD_REFRESH_FREQ (50) /* Hz */
+#endif
+
+#ifndef CONFIG_LPC17_LCD_BPP
+# define CONFIG_LPC17_LCD_BPP 16 /* Bytes per pixel */
+#endif
+
+#undef FB_FMT
+#if CONFIG_LPC17_LCD_BPP == 16
+# define FB_FMT FB_FMT_RGB16_565
+#elif CONFIG_LPC17_LCD_BPP == 24
+# define FB_FMT FB_FMT_RGB24
+#else
+# error "Unsupported BPP"
+#endif
+
+#ifndef CONFIG_LPC17_LCD_HWIDTH
+# define CONFIG_LPC17_LCD_HWIDTH 480 /* Width in pixels */
+#endif
+
+#ifndef CONFIG_LPC17_LCD_HPULSE
+# define CONFIG_LPC17_LCD_HPULSE 2
+#endif
+
+#ifndef CONFIG_LPC17_LCD_HFRONTPORCH
+# define CONFIG_LPC17_LCD_HFRONTPORCH 5
+#endif
+
+#ifndef CONFIG_LPC17_LCD_HBACKPORCH
+# define CONFIG_LPC17_LCD_HBACKPORCH 40
+#endif
+
+#ifndef CONFIG_LPC17_LCD_VHEIGHT
+# define CONFIG_LPC17_LCD_VHEIGHT 272 /* Height in rows */
+#endif
+
+#define CONFIG_LPC17_LCD_VPULSE
+# define CONFIG_LPC17_LCD_VPULSE 2
+#endif
+
+#ifndef CONFIG_LPC17_LCD_VFRONTPORCH
+# define CONFIG_LPC17_LCD_VFRONTPORCH 8
+#endif
+
+#ifndef CONFIG_LPC17_LCD_VBACKPORCH
+# define CONFIG_LPC17_LCD_VBACKPORCH 8
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+/* The LPC17 LCD driver uses the common framebuffer interfaces declared in
+ * include/nuttx/fb.h.
+ */
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H */
diff --git a/nuttx/configs/open1788/include/board.h b/nuttx/configs/open1788/include/board.h
index a5062e3fb..6767be4c9 100644
--- a/nuttx/configs/open1788/include/board.h
+++ b/nuttx/configs/open1788/include/board.h
@@ -287,8 +287,8 @@
/* UART0:
*
- * TX --- Connected to P0[2]
- * RX --- Connected to P0[3]
+ * TX --- Connected to P0[2]
+ * RX --- Connected to P0[3]
*/
#define GPIO_UART0_TXD GPIO_UART0_TXD_2
@@ -296,12 +296,12 @@
/* MCI-SDIO:
*
- * D0 --- Connected to P1[6]
- * D1 --- Connected to P2[11]
- * D2 --- Connected to P2[12]
- * D3 --- Connected to P2[13]
- * CLK--- Connected to P1[2]
- * CMD--- Connected to P1[3]
+ * D0 --- Connected to P1[6]
+ * D1 --- Connected to P2[11]
+ * D2 --- Connected to P2[12]
+ * D3 --- Connected to P2[13]
+ * CLK --- Connected to P1[2]
+ * CMD --- Connected to P1[3]
*/
#define GPIO_SD_DAT0 GPIO_SD_DAT0_2
@@ -311,6 +311,66 @@
#define GPIO_SD_CLK GPIO_SD_CLK_2
#define GPIO_SD_CMD GPIO_SD_CMD_2
+/* LCD R:
+ *
+ * VD0 --- Connected to P0[4]
+ * VD1 --- Connected to P0[5]
+ * VD2 --- Connected to P4[28]
+ * VD3 --- Connected to P4[29]
+ * VD4 --- Connected to P2[6]
+ * VD5 --- Connected to P2[7]
+ * VD6 --- Connected to P2[8]
+ * VD7 --- Connected to P2[9]
+ */
+
+#define GPIO_LCD_VD0 GPIO_LCD_VD0_1
+#define GPIO_LCD_VD1 GPIO_LCD_VD1_1
+#define GPIO_LCD_VD2 GPIO_LCD_VD2_2
+#define GPIO_LCD_VD3 GPIO_LCD_VD3_3
+#define GPIO_LCD_VD4 GPIO_LCD_VD4_1
+#define GPIO_LCD_VD5 GPIO_LCD_VD5_1
+#define GPIO_LCD_VD6 GPIO_LCD_VD6_2
+#define GPIO_LCD_VD7 GPIO_LCD_VD7_2
+
+/* LED G:
+ *
+ * VD8 --- Connected to P0[6]
+ * VD9 --- Connected to P0[7]
+ * VD10 --- Connected to P1[20]
+ * VD11 --- Connected to P1[21]
+ * VD12 --- Connected to P1[22]
+ * VD13 --- Connected to P1[23]
+ * VD14 --- Connected to P1[24]
+ * VD15 --- Connected to P1[25]
+ */
+
+#define GPIO_LCD_VD8 GPIO_LCD_VD8_1
+#define GPIO_LCD_VD9 GPIO_LCD_VD9_1
+#define GPIO_LCD_VD10 GPIO_LCD_VD10_1
+#define GPIO_LCD_VD11 GPIO_LCD_VD11_1
+#define GPIO_LCD_VD12 GPIO_LCD_VD12_1
+#define GPIO_LCD_VD13 GPIO_LCD_VD13_1
+#define GPIO_LCD_VD14 GPIO_LCD_VD14_1
+#define GPIO_LCD_VD15 GPIO_LCD_VD15_1
+
+/* LCD B:
+ *
+ * VD16 --- Connected to P0[8]
+ * VD17 --- Connected to P0[9]
+ * VD18 --- Connected to P2[12]
+ * VD19 --- Connected to P2[13]
+ * VD20 --- Connected to P1[26]
+ * VD21 --- Connected to P1[27]
+ * VD22 --- Connected to P1[28]
+ * VD23 --- Connected to P1[29]
+ *
+ * DCLK --- Connected to P2[2]
+ * LP --- Connected to P2[5]
+ * FP --- Connected to P2[3]
+ * ENAB_M --- Connected to P2[4]
+ * PWR --- Connected to P2[0]
+ */
+
/************************************************************************************
* Public Types
************************************************************************************/
diff --git a/nuttx/include/nuttx/fb.h b/nuttx/include/nuttx/fb.h
index ddff4edf8..4c38c8d64 100644
--- a/nuttx/include/nuttx/fb.h
+++ b/nuttx/include/nuttx/fb.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fb.h
*
- * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -317,17 +317,22 @@ struct fb_vtable_s
};
/****************************************************************************
- * Public Function Prototypes
+ * Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
* Name: up_fbinitialize, up_fbuninitialize, up_fbgetvplane
*
* Description:
@@ -342,9 +347,9 @@ extern "C" {
*
***************************************************************************/
-EXTERN int up_fbinitialize(void);
-EXTERN FAR struct fb_vtable_s *up_fbgetvplane(int vplane);
-EXTERN void fb_uninitialize(void);
+int up_fbinitialize(void);
+FAR struct fb_vtable_s *up_fbgetvplane(int vplane);
+void fb_uninitialize(void);
#undef EXTERN
#ifdef __cplusplus