Correct use of the BOARDIOC_GRAPHICS_SETUP boardctl() call

This commit is contained in:
Gregory Nutt 2015-04-16 07:39:00 -06:00
parent 3e01a06431
commit 804061abdc
8 changed files with 109 additions and 34 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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 */