summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/examples/nx/nx_main.c2
-rw-r--r--nuttx/arch/arm/src/sama5/sam_lcd.c1
-rw-r--r--nuttx/arch/arm/src/sama5/sam_lcd.h2
-rw-r--r--nuttx/configs/sama5d3x-ek/ov2640/defconfig115
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_ov2640.c201
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_sdram.c2
6 files changed, 299 insertions, 24 deletions
diff --git a/apps/examples/nx/nx_main.c b/apps/examples/nx/nx_main.c
index 04fc10e28..147994ebb 100644
--- a/apps/examples/nx/nx_main.c
+++ b/apps/examples/nx/nx_main.c
@@ -110,7 +110,7 @@ NXHANDLE g_fonthandle;
* Public Data
****************************************************************************/
-/* The connecton handler */
+/* The connection handler */
NXHANDLE g_hnx = NULL;
diff --git a/nuttx/arch/arm/src/sama5/sam_lcd.c b/nuttx/arch/arm/src/sama5/sam_lcd.c
index c2c004d3a..166239cc5 100644
--- a/nuttx/arch/arm/src/sama5/sam_lcd.c
+++ b/nuttx/arch/arm/src/sama5/sam_lcd.c
@@ -2814,7 +2814,6 @@ int up_fbinitialize(void)
#if defined(CONFIG_SAMA5_LCDC_OVR1) && defined(CONFIG_SAMA5_LCDC_HEO)
uint32_t regval;
#endif
- int ret;
gvdbg("Entry\n");
diff --git a/nuttx/arch/arm/src/sama5/sam_lcd.h b/nuttx/arch/arm/src/sama5/sam_lcd.h
index bc30a70e5..58e49fd2a 100644
--- a/nuttx/arch/arm/src/sama5/sam_lcd.h
+++ b/nuttx/arch/arm/src/sama5/sam_lcd.h
@@ -46,7 +46,7 @@
#include <nuttx/nx/nxglib.h>
-#include "chip/sam_lcd.h"
+#include "chip/sam_lcdc.h"
#ifdef CONFIG_SAMA5_LCDC
diff --git a/nuttx/configs/sama5d3x-ek/ov2640/defconfig b/nuttx/configs/sama5d3x-ek/ov2640/defconfig
index 80ba93552..21bcaa9dc 100644
--- a/nuttx/configs/sama5d3x-ek/ov2640/defconfig
+++ b/nuttx/configs/sama5d3x-ek/ov2640/defconfig
@@ -158,7 +158,7 @@ CONFIG_SAMA5_USART1=y
# CONFIG_SAMA5_UHPHS is not set
# CONFIG_SAMA5_UDPHS is not set
# CONFIG_SAMA5_GMAC is not set
-# CONFIG_SAMA5_LCDC is not set
+CONFIG_SAMA5_LCDC=y
CONFIG_SAMA5_ISI=y
# CONFIG_SAMA5_CAN0 is not set
# CONFIG_SAMA5_CAN1 is not set
@@ -168,12 +168,48 @@ CONFIG_SAMA5_ISI=y
# CONFIG_SAMA5_TRNG is not set
# CONFIG_SAMA5_ARM is not set
# CONFIG_SAMA5_FUSE is not set
-# CONFIG_SAMA5_MPDDRC is not set
+CONFIG_SAMA5_MPDDRC=y
# CONFIG_SAMA5_PIO_IRQ is not set
#
+# LCDC Configuration
+#
+CONFIG_SAMA5_LCDC_BACKLIGHT=y
+CONFIG_SAMA5_LCDC_DEFBACKLIGHT=0xc8
+CONFIG_SAMA5_LCDC_BACKCOLOR=0x7b5d
+CONFIG_SAMA5_LCDC_FB_VBASE=0x20000000
+CONFIG_SAMA5_LCDC_FB_PBASE=0x20000000
+CONFIG_SAMA5_LCDC_FB_SIZE=5767168
+
+#
+# Base layer configuration
+#
+CONFIG_SAMA5_LCDC_BASE_ROT0=y
+# CONFIG_SAMA5_LCDC_BASE_ROT90 is not set
+# CONFIG_SAMA5_LCDC_BASE_ROT180 is not set
+# CONFIG_SAMA5_LCDC_BASE_ROT270 is not set
+# CONFIG_SAMA5_LCDC_BASE_RGB444 is not set
+# CONFIG_SAMA5_LCDC_BASE_ARGB4444 is not set
+# CONFIG_SAMA5_LCDC_BASE_RGBA4444 is not set
+CONFIG_SAMA5_LCDC_BASE_RGB565=y
+# CONFIG_SAMA5_LCDC_BASE_TRGB1555 is not set
+# CONFIG_SAMA5_LCDC_BASE_RGB666 is not set
+# CONFIG_SAMA5_LCDC_BASE_RGB666P is not set
+# CONFIG_SAMA5_LCDC_BASE_TRGB1666 is not set
+# CONFIG_SAMA5_LCDC_BASE_TRGBP is not set
+# CONFIG_SAMA5_LCDC_BASE_RGB888 is not set
+# CONFIG_SAMA5_LCDC_BASE_RGB888P is not set
+# CONFIG_SAMA5_LCDC_BASE_TRGB1888 is not set
+# CONFIG_SAMA5_LCDC_BASE_ARGB8888 is not set
+# CONFIG_SAMA5_LCDC_BASE_RGBA8888 is not set
+
+#
# External Memory Configuration
#
+CONFIG_SAMA5_DDRCS=y
+CONFIG_SAMA5_DDRCS_SIZE=268435456
+# CONFIG_SAMA5_DDRCS_LPDDR1 is not set
+CONFIG_SAMA5_DDRCS_LPDDR2=y
CONFIG_SAMA5_EBICS0=y
CONFIG_SAMA5_EBICS0_SIZE=134217728
# CONFIG_SAMA5_EBICS0_SRAM is not set
@@ -189,12 +225,16 @@ CONFIG_SAMA5_EBICS0_NOR=y
# CONFIG_SAMA5_HAVE_NAND is not set
# CONFIG_SAMA5_HAVE_PMECC is not set
# CONFIG_SAMA5_BOOT_ISRAM is not set
+# CONFIG_SAMA5_BOOT_SDRAM is not set
CONFIG_SAMA5_BOOT_CS0FLASH=y
#
# Heap Configuration
#
CONFIG_SAMA5_ISRAM_HEAP=y
+CONFIG_SAMA5_DDRCS_HEAP=y
+CONFIG_SAMA5_DDRCS_HEAP_OFFSET=0
+CONFIG_SAMA5_DDRCS_HEAP_SIZE=268435456
#
# Architecture Options
@@ -218,7 +258,7 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=49341
# CONFIG_ARCH_CALIBRATION is not set
CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
-CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_INTERRUPTSTACK=2048
#
# Boot options
@@ -258,6 +298,8 @@ CONFIG_ARCH_HAVE_IRQBUTTONS=y
#
# Board-Specific Options
#
+CONFIG_SAMA5_MT47H128M16RT=y
+# CONFIG_SAMA5_MT47H64M16HR is not set
CONFIG_SAMA5_OV2640_DEMO=y
#
@@ -267,12 +309,12 @@ CONFIG_SAMA5_OV2640_DEMO=y
CONFIG_MSEC_PER_TICK=10
CONFIG_RR_INTERVAL=200
# CONFIG_SCHED_INSTRUMENTATION is not set
-CONFIG_TASK_NAME_SIZE=0
+CONFIG_TASK_NAME_SIZE=32
# CONFIG_SCHED_HAVE_PARENT is not set
# CONFIG_JULIAN_TIME is not set
CONFIG_START_YEAR=2013
-CONFIG_START_MONTH=7
-CONFIG_START_DAY=19
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=9
CONFIG_DEV_CONSOLE=y
# CONFIG_MUTEX_TYPES is not set
# CONFIG_PRIORITY_INHERITANCE is not set
@@ -352,7 +394,6 @@ CONFIG_VIDEO_OV2640=y
# CONFIG_OV2640_MULTIPLE is not set
CONFIG_OV2640_I2CADDR=0x21
CONFIG_OV2640_FREQUENCY=400000
-CONFIG_OV2640_I2CMODE=0
CONFIG_OV2640_RGB565_COLORFMT=y
# CONFIG_OV2640_YUV422_COLORFMT is not set
# CONFIG_OV2640_JPEG is not set
@@ -443,14 +484,70 @@ CONFIG_DISABLE_MOUNTPOINT=y
#
# Graphics Support
#
-# CONFIG_NX is not set
+CONFIG_NX=y
+CONFIG_NX_NPLANES=1
+# CONFIG_NX_WRITEONLY is not set
+
+#
+# Supported Pixel Depths
+#
+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=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=y
+
+#
+# Input Devices
+#
+# CONFIG_NX_MOUSE is not set
+# CONFIG_NX_KBD is not set
+
+#
+# Framed Window Borders
+#
+CONFIG_NXTK_BORDERWIDTH=3
+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 is not set
+# CONFIG_NXFONT_SANS22X29 is not set
+# CONFIG_NXFONT_SANS28X37 is not set
+# CONFIG_NXFONT_SANS39X48 is not set
+CONFIG_NXFONT_SANS17X23B=y
+# CONFIG_NXFONT_SANS20X27B is not set
+# CONFIG_NXFONT_SANS22X29B is not set
+# 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_NXCONSOLE is not set
+
+#
+# NX Multi-user only options
+#
+# CONFIG_NX_MULTIUSER is not set
#
# Memory Management
#
# CONFIG_MM_MULTIHEAP is not set
# CONFIG_MM_SMALL is not set
-CONFIG_MM_REGIONS=1
+CONFIG_MM_REGIONS=2
# CONFIG_GRAN is not set
#
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c b/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c
index 9059ecd47..aa71ae79e 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_ov2640.c
@@ -1,4 +1,4 @@
-/************************************************************************************
+/****************************************************************************
* configs/sama5d3x-ek/src/sam_ov2640.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
@@ -31,33 +31,178 @@
* 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 <stdlib.h>
#include <debug.h>
+#include <nuttx/fb.h>
+#include <nuttx/nx/nx.h>
+
+#include "up_arch.h"
+
+#include "sam_periphclks.h"
+#include "sam_lcd.h"
+#include "sam_pck.h"
#include "sama5d3x-ek.h"
#if defined(CONFIG_SAMA5_ISI) && defined(CONFIG_SAMA5_OV2640_DEMO)
-/************************************************************************************
+/****************************************************************************
* Definitions
- ************************************************************************************/
-/* Configuration ********************************************************************/
+ ****************************************************************************/
+/* Configuration ************************************************************/
-/************************************************************************************
+/****************************************************************************
* Private Data
- ************************************************************************************/
+ ****************************************************************************/
-/************************************************************************************
+/* The connection handler */
+
+static NXHANDLE g_hnx = NULL;
+
+/****************************************************************************
* Private Functions
- ************************************************************************************/
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: ov2640_lcd_initialize
+ ****************************************************************************/
+
+#ifndef CONFIG_NX_MULTIUSER
+static inline int ov2640_lcd_initialize(void)
+{
+ FAR NX_DRIVERTYPE *dev;
+ int ret;
+
+ /* Initialize the frame buffer device */
+
+ gvdbg("Initializing framebuffer\n");
+ ret = up_fbinitialize();
+ if (ret < 0)
+ {
+ gdbg("ERROR: up_fbinitialize failed: %d\n", -ret);
+ return EXIT_FAILURE;
+ }
+
+ dev = up_fbgetvplane(0);
+ if (!dev)
+ {
+ gdbg("ERROR: up_fbgetvplane failed\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Then open NX */
+
+ gvdbg("Open NX\n");
+ g_hnx = nx_open(dev);
+ if (!g_hnx)
+ {
+ gdbg("ERROR: nx_open failed: %d\n", errno);
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
+#endif
+
+#ifdef CONFIG_NX_MULTIUSER
+static inline int ov2640_lcd_initialize(void)
+{
+ struct sched_param param;
+ pthread_t thread;
+ pid_t servrid;
+ int ret;
+
+ /* Set the client task priority */
+
+ param.sched_priority = CONFIG_EXAMPLES_NX_CLIENTPRIO;
+ ret = sched_setparam(0, &param);
+ if (ret < 0)
+ {
+ gdbg("ERROR: sched_setparam failed: %d\n" , ret);
+ return EXIT_FAILURE;
+ }
+
+ /* Start the server task */
+
+ gvdbg("Starting nx_servertask task\n");
+ servrid = task_create("NX Server", CONFIG_EXAMPLES_NX_SERVERPRIO,
+ CONFIG_EXAMPLES_NX_STACKSIZE, nx_servertask, NULL);
+ if (servrid < 0)
+ {
+ gdbg("ERROR: Failed to create nx_servertask task: %d\n", errno);
+ return EXIT_FAILURE;
+ }
+
+ /* Wait a bit to let the server get started */
+
+ sleep(1);
+
+ /* Connect to the server */
+
+ g_hnx = nx_connect();
+ if (g_hnx)
+ {
+ pthread_attr_t attr;
+
+ /* Start a separate thread to listen for server events. This is probably
+ * the least efficient way to do this, but it makes this example flow more
+ * smoothly.
+ */
+
+ (void)pthread_attr_init(&attr);
+ param.sched_priority = CONFIG_EXAMPLES_NX_LISTENERPRIO;
+ (void)pthread_attr_setschedparam(&attr, &param);
+ (void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NX_STACKSIZE);
+
+ ret = pthread_create(&thread, &attr, nx_listenerthread, NULL);
+ if (ret != 0)
+ {
+ printf("pthread_create failed: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+
+ /* Don't return until we are connected to the server */
+
+ while (!g_connected)
+ {
+ /* Wait for the listener thread to wake us up when we really
+ * are connected.
+ */
+
+ (void)sem_wait(&g_semevent);
+ }
+ }
+ else
+ {
+ gdbg("ERROR: nx_connect failed: %d\n", errno);
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
+#endif
+
+/****************************************************************************
+ * Name: ov2640_camera_initialize
+ ****************************************************************************/
+
+static inline int ov2640_camera_initialize(void)
+{
+ /* Enable clocking to the ISI peripheral */
+
+ sam_isi_enableclk();
+
+#warning Missing Logic
+ return EXIT_FAILURE;
+}
/************************************************************************************
* Public Functions
@@ -73,7 +218,41 @@
int ov2640_main(int argc, char *argv[])
{
+ int ret;
+
+ /* First, initialize the display */
+
+ ret = ov2640_lcd_initialize();
+ if (ret != EXIT_SUCCESS)
+ {
+ gdbg("ERROR: ov2640_lcd_initialize failed\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Then, initialize the camera */
+
+ ret = ov2640_camera_initialize();
+ if (ret != EXIT_SUCCESS)
+ {
+ gdbg("ERROR: ov2640_camera_initialize failed\n");
+ goto errout_with_nx;
+ }
+
return EXIT_SUCCESS;
+
+errout_with_nx:
+#ifdef CONFIG_NX_MULTIUSER
+ /* Disconnect from the server */
+
+ gvdbg("Disconnect from the server\n");
+ nx_disconnect(g_hnx);
+#else
+ /* Close the server */
+
+ gvdbg("Close NX\n");
+ nx_close(g_hnx);
+#endif
+ return EXIT_FAILURE;
}
#endif /* CONFIG_SAMA5_ISI && CONFIG_SAMA5_OV2640_DEMO */
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_sdram.c b/nuttx/configs/sama5d3x-ek/src/sam_sdram.c
index cfa4ef426..f1fe8c328 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_sdram.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_sdram.c
@@ -86,7 +86,7 @@
# define DDR2_BA1 (1 << 26)
#else
-# error Unknwon SDRAM type
+# error Unknown SDRAM type
#endif
/****************************************************************************