summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-04-16 07:39:00 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-04-16 09:11:49 -0600
commit90d1bf8b943e741b411d4427a73591a9e67308d5 (patch)
treeb11ee5bf763186b68eb4601adb50957b5965443e
parent57285f5dee6d4b9c93b63f70365c81ea195400d0 (diff)
downloadpx4-nuttx-90d1bf8b943e741b411d4427a73591a9e67308d5.tar.gz
px4-nuttx-90d1bf8b943e741b411d4427a73591a9e67308d5.tar.bz2
px4-nuttx-90d1bf8b943e741b411d4427a73591a9e67308d5.zip
Correct use of the BOARDIOC_GRAPHICS_SETUP boardctl() call
-rw-r--r--NxWidgets/libnxwidgets/src/cnxserver.cxx32
-rw-r--r--apps/examples/nx/nx_main.c16
-rw-r--r--apps/examples/nx/nx_server.c21
-rw-r--r--apps/examples/nxhello/nxhello_main.c17
-rw-r--r--apps/examples/nximage/nximage_main.c17
-rw-r--r--apps/examples/nxlines/nxlines_main.c17
-rw-r--r--apps/examples/nxterm/nxterm_server.c19
-rw-r--r--apps/examples/nxtext/nxtext_main.c18
-rw-r--r--apps/examples/nxtext/nxtext_server.c18
9 files changed, 135 insertions, 40 deletions
diff --git a/NxWidgets/libnxwidgets/src/cnxserver.cxx b/NxWidgets/libnxwidgets/src/cnxserver.cxx
index 3ac00e7fb..19b87a043 100644
--- a/NxWidgets/libnxwidgets/src/cnxserver.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxserver.cxx
@@ -127,15 +127,25 @@ CNxServer::~CNxServer(void)
bool CNxServer::connect(void)
{
#if defined(CONFIG_NXWIDGETS_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
// Use external graphics driver initialization
- m_hDevice = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_NXWIDGETS_DEVNO);
- if (!m_hDevice)
+ printf("nxtext_initialize: Initializing external graphics device\n");
+
+ devinfo.devno = CONFIG_NXWIDGETS_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- gdbg("boardctl failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO);
+ gdbg("boardctl failed, devno=%d: %d\n", CONFIG_NXWIDGETS_DEVNO, errno);
return false;
}
+ m_hDevice = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
int ret;
@@ -359,15 +369,25 @@ int CNxServer::server(int argc, char *argv[])
int ret;
#if defined(CONFIG_NXWIDGETS_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
// Use external graphics driver initialization
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_NXWIDGETS_DEVNO);
- if (!dev)
+ printf("nxtext_initialize: Initializing external graphics device\n");
+
+ devinfo.devno = CONFIG_NXWIDGETS_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- gdbg("boardctl failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO);
+ gdbg("boardctl failed, devno=%d: %d\n", CONFIG_NXWIDGETS_DEVNO, errno);
return EXIT_FAILURE;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
// Initialize the LCD device
diff --git a/apps/examples/nx/nx_main.c b/apps/examples/nx/nx_main.c
index e9d3eaa92..dbdd608fa 100644
--- a/apps/examples/nx/nx_main.c
+++ b/apps/examples/nx/nx_main.c
@@ -427,17 +427,27 @@ static inline int nxeg_suinitialize(void)
FAR NX_DRIVERTYPE *dev;
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nxeg_initialize: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NX_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NX_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxeg_initialize: boardctl failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO);
+ printf("nxeg_initialize: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NX_DEVNO, errno);
g_exitcode = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
int ret;
diff --git a/apps/examples/nx/nx_server.c b/apps/examples/nx/nx_server.c
index fbb9a1b92..b13eb6d54 100644
--- a/apps/examples/nx/nx_server.c
+++ b/apps/examples/nx/nx_server.c
@@ -63,7 +63,7 @@
#ifdef CONFIG_NX_MULTIUSER
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@@ -92,18 +92,27 @@ int nx_servertask(int argc, char *argv[])
int ret;
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
- printf("nxeg_initialize: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NX_DEVNO);
- if (!dev)
+ printf("nx_servertask: Initializing external graphics device\n");
+
+ devinfo.devno = CONFIG_EXAMPLES_NX_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxeg_initialize: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NX_DEVNO);
+ printf("nx_servertask: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NX_DEVNO, errno);
g_exitcode = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
/* Initialize the LCD device */
diff --git a/apps/examples/nxhello/nxhello_main.c b/apps/examples/nxhello/nxhello_main.c
index 61b2b5393..2082d71b0 100644
--- a/apps/examples/nxhello/nxhello_main.c
+++ b/apps/examples/nxhello/nxhello_main.c
@@ -126,18 +126,27 @@ static inline int nxhello_initialize(void)
FAR NX_DRIVERTYPE *dev;
#if defined(CONFIG_EXAMPLES_NXHELLO_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nxhello_initialize: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXHELLO_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NXHELLO_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxhello_initialize: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NXHELLO_DEVNO);
+ printf("nxhello_initialize: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NXHELLO_DEVNO, errno);
g_nxhello.code = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
int ret;
diff --git a/apps/examples/nximage/nximage_main.c b/apps/examples/nximage/nximage_main.c
index 9bf6112b8..9d84b64ba 100644
--- a/apps/examples/nximage/nximage_main.c
+++ b/apps/examples/nximage/nximage_main.c
@@ -130,18 +130,27 @@ static inline int nximage_initialize(void)
FAR NX_DRIVERTYPE *dev;
#if defined(CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nximage_initialize: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXIMAGE_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NXIMAGE_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nximage_initialize: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NXIMAGE_DEVNO);
+ printf("nximage_initialize: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NXIMAGE_DEVNO, errno);
g_nximage.code = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
int ret;
diff --git a/apps/examples/nxlines/nxlines_main.c b/apps/examples/nxlines/nxlines_main.c
index 08d2573e8..eb4a26b13 100644
--- a/apps/examples/nxlines/nxlines_main.c
+++ b/apps/examples/nxlines/nxlines_main.c
@@ -122,18 +122,27 @@ static inline int nxlines_initialize(void)
FAR NX_DRIVERTYPE *dev;
#if defined(CONFIG_EXAMPLES_NXLINES_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nxlines_initialize: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXLINES_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NXLINES_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxlines_initialize: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NXLINES_DEVNO);
+ printf("nxlines_initialize: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NXLINES_DEVNO, errno);
g_nxlines.code = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
int ret;
diff --git a/apps/examples/nxterm/nxterm_server.c b/apps/examples/nxterm/nxterm_server.c
index c52f73c79..1be10e17b 100644
--- a/apps/examples/nxterm/nxterm_server.c
+++ b/apps/examples/nxterm/nxterm_server.c
@@ -60,7 +60,7 @@
#include "nxterm_internal.h"
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@@ -89,17 +89,26 @@ int nxterm_server(int argc, char *argv[])
int ret;
#if defined(CONFIG_EXAMPLES_NXCON_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nxterm_server: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXCON_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NXCON_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxterm_server: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NXCON_DEVNO);
+ printf("nxterm_server: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NXCON_DEVNO, errno);
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
/* Initialize the LCD device */
diff --git a/apps/examples/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c
index ed00fc04d..209941fd3 100644
--- a/apps/examples/nxtext/nxtext_main.c
+++ b/apps/examples/nxtext/nxtext_main.c
@@ -41,6 +41,7 @@
#include <sys/types.h>
+#include <sys/boardctl.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
@@ -167,18 +168,27 @@ static inline int nxtext_suinitialize(void)
FAR NX_DRIVERTYPE *dev;
#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nxtext_initialize: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXTEXT_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NXTEXT_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxtext_initialize: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NXTEXT_DEVNO);
+ printf("nxtext_initialize: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NXTEXT_DEVNO, errno);
g_exitcode = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
int ret;
diff --git a/apps/examples/nxtext/nxtext_server.c b/apps/examples/nxtext/nxtext_server.c
index 844c800bf..813d56ed1 100644
--- a/apps/examples/nxtext/nxtext_server.c
+++ b/apps/examples/nxtext/nxtext_server.c
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
+#include <sys/boardctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -90,18 +91,27 @@ int nxtext_server(int argc, char *argv[])
int ret;
#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT)
+ struct boardioc_graphics_s devinfo;
+ int ret;
+
/* Use external graphics driver initialization */
printf("nxtext_server: Initializing external graphics device\n");
- dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXTEXT_DEVNO);
- if (!dev)
+
+ devinfo.devno = CONFIG_EXAMPLES_NXTEXT_DEVNO;
+ devinfo.dev = NULL;
+
+ ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
+ if (ret < 0)
{
- printf("nxtext_server: boardctl failed, devno=%d\n",
- CONFIG_EXAMPLES_NXTEXT_DEVNO);
+ printf("nxtext_server: boardctl failed, devno=%d: %d\n",
+ CONFIG_EXAMPLES_NXTEXT_DEVNO, errno);
g_exitcode = NXEXIT_EXTINITIALIZE;
return ERROR;
}
+ dev = devinfo.dev;
+
#elif defined(CONFIG_NX_LCDDRIVER)
/* Initialize the LCD device */