diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-03-31 16:20:21 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-03-31 16:20:21 -0600 |
commit | 1aa554ab19210a162ab3ba7f8a635b1f11586aa2 (patch) | |
tree | 32eded82fe4e2e27796081de9c73f57613d1a322 | |
parent | 89e6ac65fdaef533a95ad504bb18ec50c9cd977f (diff) | |
download | px4-nuttx-1aa554ab19210a162ab3ba7f8a635b1f11586aa2.tar.gz px4-nuttx-1aa554ab19210a162ab3ba7f8a635b1f11586aa2.tar.bz2 px4-nuttx-1aa554ab19210a162ab3ba7f8a635b1f11586aa2.zip |
Rename up_nxdrvinit() to board_graphics_setup(). Add CONFIG_BOARDCTL_GRAPHICS that will enabled calls to board_graphics_setup() from boardctrl(). In apps/ and NxWidgts/, replace all calls to up_nxdrvinit with calls to boardctl().
35 files changed, 256 insertions, 145 deletions
diff --git a/NxWidgets/libnxwidgets/src/cnxserver.cxx b/NxWidgets/libnxwidgets/src/cnxserver.cxx index d47fa74c1..1c28a6b4a 100644 --- a/NxWidgets/libnxwidgets/src/cnxserver.cxx +++ b/NxWidgets/libnxwidgets/src/cnxserver.cxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/src/cnxserver.cxx * - * Copyright (C) 2012, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <sys/boardctl.h> #include <stdint.h> #include <stdbool.h> #include <unistd.h> @@ -125,10 +126,10 @@ bool CNxServer::connect(void) #if defined(CONFIG_NXWIDGETS_EXTERNINIT) // Use external graphics driver initialization - m_hDevice = up_nxdrvinit(CONFIG_NXWIDGETS_DEVNO); + m_hDevice = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_NXWIDGETS_DEVNO); if (!m_hDevice) { - gdbg("up_nxdrvinit failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO); + gdbg("boardctl failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO); return false; } @@ -357,10 +358,10 @@ int CNxServer::server(int argc, char *argv[]) #if defined(CONFIG_NXWIDGETS_EXTERNINIT) // Use external graphics driver initialization - dev = up_nxdrvinit(CONFIG_NXWIDGETS_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_NXWIDGETS_DEVNO); if (!dev) { - gdbg("up_nxdrvinit failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO); + gdbg("boardctl failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO); return EXIT_FAILURE; } diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 27ff6d1e2..aeb2f6261 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -909,11 +909,15 @@ examples/nx function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + This test can be performed with either the single-user version of NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER. If CONFIG_NX_MULTIUSER is defined, then the following configuration @@ -982,11 +986,15 @@ examples/nxterm function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + CONFIG_EXAMPLES_NXCON_MINOR -- The NX console device minor number. Default is 0 corresponding to /dev/nxterm0 CONFIG_EXAMPLES_NXCON_DEVNAME -- The quoated, full path to the @@ -1054,11 +1062,15 @@ examplex/nxhello function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + examples/nximage ^^^^^^^^^^^^^^^^ @@ -1090,11 +1102,15 @@ examples/nximage function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + How was that run-length encoded image produced? a. I used GIMP output the image as a .c file. @@ -1148,11 +1164,15 @@ examplex/nxlines function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + CONFIG_NSH_BUILTIN_APPS - Build the NX lines examples as an NSH built-in function. @@ -1203,11 +1223,15 @@ examples/nxtext function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + CONFIG_EXAMPLES_NXTEXT_BMCACHE - The maximum number of characters that can be put in the background window. Default is 128. CONFIG_EXAMPLES_NXTEXT_GLCACHE - The maximum nuber of pre-rendered diff --git a/apps/examples/nx/Kconfig b/apps/examples/nx/Kconfig index 099f22332..2c47aa777 100644 --- a/apps/examples/nx/Kconfig +++ b/apps/examples/nx/Kconfig @@ -99,11 +99,15 @@ config EXAMPLES_NX_EXTERNINIT must provide an LCD initialization function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + if NX_MULTIUSER comment "Multi-User Configuration Options" diff --git a/apps/examples/nx/nx_internal.h b/apps/examples/nx/nx_internal.h index 67504227a..ff1c3b63a 100644 --- a/apps/examples/nx/nx_internal.h +++ b/apps/examples/nx/nx_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nx/nx_internal.h * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -276,22 +276,18 @@ extern nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES]; * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NX_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - #if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER) -extern int nx_servertask(int argc, char *argv[]); -extern FAR void *nx_listenerthread(FAR void *arg); +int nx_servertask(int argc, char *argv[]); +FAR void *nx_listenerthread(FAR void *arg); #endif #ifdef CONFIG_NX_KBD -extern void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); +void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -extern void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); +void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); #endif -extern void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR struct nxeg_state_s *st); +void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR struct nxeg_state_s *st); #endif #endif /* __EXAMPLES_NX_NX_INTERNAL_H */ diff --git a/apps/examples/nx/nx_main.c b/apps/examples/nx/nx_main.c index 1111d4ee2..ba5a1077e 100644 --- a/apps/examples/nx/nx_main.c +++ b/apps/examples/nx/nx_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nx/nx_main.c * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <sys/boardctl.h> #include <stdint.h> #include <stdbool.h> #include <stdio.h> @@ -426,10 +427,10 @@ static inline int nxeg_suinitialize(void) /* Use external graphics driver initialization */ printf("nxeg_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NX_DEVNO); if (!dev) { - printf("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + printf("nxeg_initialize: boardctl failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); g_exitcode = NXEXIT_EXTINITIALIZE; return ERROR; } diff --git a/apps/examples/nx/nx_server.c b/apps/examples/nx/nx_server.c index 5a4aa4096..029700859 100644 --- a/apps/examples/nx/nx_server.c +++ b/apps/examples/nx/nx_server.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nx/nx_server.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <sys/boardctl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -92,10 +93,11 @@ int nx_servertask(int argc, char *argv[]) /* Use external graphics driver initialization */ printf("nxeg_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NX_DEVNO); if (!dev) { - printf("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + printf("nxeg_initialize: boardctl failed, devno=%d\n", + CONFIG_EXAMPLES_NX_DEVNO); g_exitcode = NXEXIT_EXTINITIALIZE; return ERROR; } diff --git a/apps/examples/nxhello/Kconfig b/apps/examples/nxhello/Kconfig index 4f15c94f6..756b85c84 100644 --- a/apps/examples/nxhello/Kconfig +++ b/apps/examples/nxhello/Kconfig @@ -84,9 +84,13 @@ config EXAMPLES_NXHELLO_EXTERNINIT must provide an LCD initialization function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + endif diff --git a/apps/examples/nxhello/nxhello.h b/apps/examples/nxhello/nxhello.h index 010294149..4dde63a16 100644 --- a/apps/examples/nxhello/nxhello.h +++ b/apps/examples/nxhello/nxhello.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxhello/nxhello.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -169,12 +169,8 @@ extern const struct nx_callback_s g_nxhellocb; * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NXHELLO_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - /* Background window interfaces */ -extern void nxhello_hello(NXWINDOW hwnd); +void nxhello_hello(NXWINDOW hwnd); #endif /* __APPS_EXAMPLES_NXHELLO_NXHELLO_H */ diff --git a/apps/examples/nxhello/nxhello_main.c b/apps/examples/nxhello/nxhello_main.c index 6c8f7b966..6f9127253 100644 --- a/apps/examples/nxhello/nxhello_main.c +++ b/apps/examples/nxhello/nxhello_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxhello/nxhello_main.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <sys/boardctl.h> #include <stdint.h> #include <stdbool.h> @@ -126,10 +127,10 @@ static inline int nxhello_initialize(void) /* Use external graphics driver initialization */ printf("nxhello_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXHELLO_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXHELLO_DEVNO); if (!dev) { - printf("nxhello_initialize: up_nxdrvinit failed, devno=%d\n", + printf("nxhello_initialize: boardctl failed, devno=%d\n", CONFIG_EXAMPLES_NXHELLO_DEVNO); g_nxhello.code = NXEXIT_EXTINITIALIZE; return ERROR; diff --git a/apps/examples/nximage/nximage.h b/apps/examples/nximage/nximage.h index fc4fdcefd..94ca8297c 100644 --- a/apps/examples/nximage/nximage.h +++ b/apps/examples/nximage/nximage.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nximage/nximage.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -182,18 +182,14 @@ extern const struct nx_callback_s g_nximagecb; * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - /* Background window interfaces */ -extern void nximage_image(NXWINDOW hwnd); +void nximage_image(NXWINDOW hwnd); /* Image interfaces */ -extern nxgl_mxpixel_t nximage_bgcolor(void); -extern nxgl_mxpixel_t nximage_avgcolor(nxgl_mxpixel_t color1, nxgl_mxpixel_t color2); -extern void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state); +nxgl_mxpixel_t nximage_bgcolor(void); +nxgl_mxpixel_t nximage_avgcolor(nxgl_mxpixel_t color1, nxgl_mxpixel_t color2); +void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state); #endif /* __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H */ diff --git a/apps/examples/nximage/nximage_main.c b/apps/examples/nximage/nximage_main.c index 4b3d75dce..d5020ec75 100644 --- a/apps/examples/nximage/nximage_main.c +++ b/apps/examples/nximage/nximage_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nximage/nximage_main.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <sys/boardctl.h> #include <stdint.h> #include <stdbool.h> @@ -130,10 +131,10 @@ static inline int nximage_initialize(void) /* Use external graphics driver initialization */ printf("nximage_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXIMAGE_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXIMAGE_DEVNO); if (!dev) { - printf("nximage_initialize: up_nxdrvinit failed, devno=%d\n", + printf("nximage_initialize: boardctl failed, devno=%d\n", CONFIG_EXAMPLES_NXIMAGE_DEVNO); g_nximage.code = NXEXIT_EXTINITIALIZE; return ERROR; diff --git a/apps/examples/nxlines/Kconfig b/apps/examples/nxlines/Kconfig index 0b75d6eba..ff88c085f 100644 --- a/apps/examples/nxlines/Kconfig +++ b/apps/examples/nxlines/Kconfig @@ -90,10 +90,13 @@ config EXAMPLES_NXLINES_EXTERNINIT initialization function with a prototype like: #ifdef NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif -endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. +endif diff --git a/apps/examples/nxlines/nxlines.h b/apps/examples/nxlines/nxlines.h index 6a54e8f09..65f983245 100644 --- a/apps/examples/nxlines/nxlines.h +++ b/apps/examples/nxlines/nxlines.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxlines/nxlines.h * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -166,12 +166,8 @@ extern const struct nx_callback_s g_nxlinescb; * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NXLINES_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - /* Background window interfaces */ -extern void nxlines_test(NXWINDOW hwnd); +void nxlines_test(NXWINDOW hwnd); #endif /* __APPS_EXAMPLES_NXLINES_NXLINES_H */ diff --git a/apps/examples/nxlines/nxlines_main.c b/apps/examples/nxlines/nxlines_main.c index 21798b7d1..145b5b754 100644 --- a/apps/examples/nxlines/nxlines_main.c +++ b/apps/examples/nxlines/nxlines_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxlines/nxlines_main.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -122,10 +122,10 @@ static inline int nxlines_initialize(void) /* Use external graphics driver initialization */ printf("nxlines_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXLINES_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXLINES_DEVNO); if (!dev) { - printf("nxlines_initialize: up_nxdrvinit failed, devno=%d\n", + printf("nxlines_initialize: boardctl failed, devno=%d\n", CONFIG_EXAMPLES_NXLINES_DEVNO); g_nxlines.code = NXEXIT_EXTINITIALIZE; return ERROR; diff --git a/apps/examples/nxterm/nxterm_internal.h b/apps/examples/nxterm/nxterm_internal.h index 29a196f0e..5d1df732e 100644 --- a/apps/examples/nxterm/nxterm_internal.h +++ b/apps/examples/nxterm/nxterm_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxterm/nxterm_internal.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -276,15 +276,10 @@ extern const struct nx_callback_s g_nxtoolcb; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -/* Board-specific driver intiialization */ - -#ifdef CONFIG_EXAMPLES_NXCON_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif /* Server thread support */ -extern int nxterm_server(int argc, char *argv[]); -extern FAR void *nxterm_listener(FAR void *arg); +int nxterm_server(int argc, char *argv[]); +FAR void *nxterm_listener(FAR void *arg); #endif /* __EXAMPLES_NXTERM_NXCON_INTERNAL_H */ diff --git a/apps/examples/nxterm/nxterm_server.c b/apps/examples/nxterm/nxterm_server.c index 7e30a11fe..4eaa83c17 100644 --- a/apps/examples/nxterm/nxterm_server.c +++ b/apps/examples/nxterm/nxterm_server.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxterm/nxterm_server.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <sys/boardctl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -90,10 +91,11 @@ int nxterm_server(int argc, char *argv[]) /* Use external graphics driver initialization */ printf("nxterm_server: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXCON_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXCON_DEVNO); if (!dev) { - printf("nxterm_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO); + printf("nxterm_server: boardctl failed, devno=%d\n", + CONFIG_EXAMPLES_NXCON_DEVNO); return ERROR; } diff --git a/apps/examples/nxtext/Kconfig b/apps/examples/nxtext/Kconfig index d7dc1be82..013c04460 100644 --- a/apps/examples/nxtext/Kconfig +++ b/apps/examples/nxtext/Kconfig @@ -118,11 +118,15 @@ config EXAMPLES_NXTEXT_EXTERNINIT must provide an LCD initialization function with a prototype like: #ifdef CONFIG_NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); #endif + and must also define: CONFIG_LIB_BOARDCTL=y and + CONFIG_BOARDCTL_GRAPHICS=y so that the boardctl() interface + will be available in order to access this function. + if NX_MULTIUSER comment "Multi-User Configuration Options" diff --git a/apps/examples/nxtext/nxtext_internal.h b/apps/examples/nxtext/nxtext_internal.h index 9c29315c0..3e4b27b8d 100644 --- a/apps/examples/nxtext/nxtext_internal.h +++ b/apps/examples/nxtext/nxtext_internal.h @@ -315,32 +315,29 @@ extern int g_exitcode; * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NXTEXT_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif #if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER) -extern int nxtext_server(int argc, char *argv[]); -extern FAR void *nxtext_listener(FAR void *arg); +int nxtext_server(int argc, char *argv[]); +FAR void *nxtext_listener(FAR void *arg); #endif /* Background window interfaces */ -extern FAR struct nxtext_state_s *nxbg_getstate(void); -extern void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen); +FAR struct nxtext_state_s *nxbg_getstate(void); +void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen); /* Pop-up window interfaces */ -extern NXWINDOW nxpu_open(void); -extern int nxpu_close(NXWINDOW hwnd); +NXWINDOW nxpu_open(void); +int nxpu_close(NXWINDOW hwnd); /* Generic text helpers */ -extern void nxtext_home(FAR struct nxtext_state_s *st); -extern void nxtext_newline(FAR struct nxtext_state_s *st); -extern void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, - NXHANDLE hfont, uint8_t ch); -extern void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR struct nxtext_state_s *st, NXHANDLE hfont, - FAR const struct nxtext_bitmap_s *bm); +void nxtext_home(FAR struct nxtext_state_s *st); +void nxtext_newline(FAR struct nxtext_state_s *st); +void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, + NXHANDLE hfont, uint8_t ch); +void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR struct nxtext_state_s *st, NXHANDLE hfont, + FAR const struct nxtext_bitmap_s *bm); #endif /* __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H */ diff --git a/apps/examples/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c index b1a795484..b3553dfd9 100644 --- a/apps/examples/nxtext/nxtext_main.c +++ b/apps/examples/nxtext/nxtext_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxtext/nxtext_main.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -168,10 +168,11 @@ static inline int nxtext_suinitialize(void) /* Use external graphics driver initialization */ printf("nxtext_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXTEXT_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXTEXT_DEVNO); if (!dev) { - printf("nxtext_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); + printf("nxtext_initialize: boardctl failed, devno=%d\n", + CONFIG_EXAMPLES_NXTEXT_DEVNO); g_exitcode = NXEXIT_EXTINITIALIZE; return ERROR; } diff --git a/apps/examples/nxtext/nxtext_server.c b/apps/examples/nxtext/nxtext_server.c index ff3041a69..5dc12261f 100644 --- a/apps/examples/nxtext/nxtext_server.c +++ b/apps/examples/nxtext/nxtext_server.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxtext/nxtext_server.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -92,10 +92,11 @@ int nxtext_server(int argc, char *argv[]) /* Use external graphics driver initialization */ printf("nxtext_server: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXTEXT_DEVNO); + dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_EXAMPLES_NXTEXT_DEVNO); if (!dev) { - printf("nxtext_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); + printf("nxtext_server: boardctl failed, devno=%d\n", + CONFIG_EXAMPLES_NXTEXT_DEVNO); g_exitcode = NXEXIT_EXTINITIALIZE; return ERROR; } diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index 4fe6e0928..fab01136d 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -1596,6 +1596,10 @@ config BOARDCTL_ADCTEST bool "Enable ADC test interfaces" default n +config BOARDCTL_GRAPHICS + bool "Enable custom graphics initialization interfaces" + default n + config BOARDCTL_IOCTL bool "Board-specific boardctl() commands" default n diff --git a/nuttx/configs/boardctl.c b/nuttx/configs/boardctl.c index 953b3e2d0..e8903f085 100755 --- a/nuttx/configs/boardctl.c +++ b/nuttx/configs/boardctl.c @@ -141,6 +141,26 @@ int boardctl(unsigned int cmd, uintptr_t arg) break; #endif +#ifdef CONFIG_BOARDCTL_GRAPHICS + /* CMD: BOARDIOC_GRAPHICS_SETUP + * DESCRIPTION: Configure graphics that require special initialization + * procedures + * ARG: A pointer to an instance of struct boardioc_graphics_s + * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_GRAPHICS + * DEPENDENCIES: Board logic must provide board_adc_setup() + */ + + case BOARDIOC_GRAPHICS_SETUP: + { + FAR struct boardioc_graphics_s *setup = + ( FAR struct boardioc_graphics_s *)arg; + + setup->dev = board_graphics_setup(setup->devno); + ret = setup->dev ? OK : -ENODEV; + } + break; +#endif + default: { #ifdef CONFIG_BOARDCTL_IOCTL diff --git a/nuttx/configs/lm3s6965-ek/src/lm_oled.c b/nuttx/configs/lm3s6965-ek/src/lm_oled.c index b2582ce82..7aa01e931 100644 --- a/nuttx/configs/lm3s6965-ek/src/lm_oled.c +++ b/nuttx/configs/lm3s6965-ek/src/lm_oled.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/lm3s6965-ek/src/lm_oled.c * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include <debug.h> #include <errno.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/p14201.h> @@ -84,27 +85,27 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; /* Configure the OLED GPIOs */ - oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup"); - oleddc_dumpgpio("up_nxdrvinit: On entry"); + oledcs_dumpgpio("board_graphics_setup: After OLEDCS setup"); + oleddc_dumpgpio("board_graphics_setup: On entry"); tiva_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */ tiva_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */ - oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup"); + oleddc_dumpgpio("board_graphics_setup: After OLEDDC/EN setup"); /* Get the SSI port (configure as a Freescale SPI port) */ @@ -132,6 +133,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) return dev; } } + return NULL; } diff --git a/nuttx/configs/lm3s8962-ek/src/lm_oled.c b/nuttx/configs/lm3s8962-ek/src/lm_oled.c index cc641adcb..b171881cb 100644 --- a/nuttx/configs/lm3s8962-ek/src/lm_oled.c +++ b/nuttx/configs/lm3s8962-ek/src/lm_oled.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/lm3s8962-ek/src/lm_oled.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include <debug.h> #include <errno.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/p14201.h> @@ -84,27 +85,27 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; /* Configure the OLED GPIOs */ - oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup"); - oleddc_dumpgpio("up_nxdrvinit: On entry"); + oledcs_dumpgpio("board_graphics_setup: After OLEDCS setup"); + oleddc_dumpgpio("board_graphics_setup: On entry"); tiva_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */ tiva_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */ - oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup"); + oleddc_dumpgpio("board_graphics_setup: After OLEDDC/EN setup"); /* Get the SSI port (configure as a Freescale SPI port) */ diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_oled.c b/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_oled.c index 01692b65b..b14186f26 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_oled.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_oled.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/lpcxpresso-lpc1768/src/lpc17_oled.c * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include <debug.h> #include <errno.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/ug-9664hswag01.h> @@ -98,14 +99,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; @@ -114,13 +115,13 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) * J43, J45 pin1-2 and J46 pin 1-2. */ - oledcs_dumpgpio("up_nxdrvinit: After OLED CS setup"); - oleddc_dumpgpio("up_nxdrvinit: On entry"); + oledcs_dumpgpio("board_graphics_setup: After OLED CS setup"); + oleddc_dumpgpio("board_graphics_setup: On entry"); (void)lpc17_configgpio(LPCXPRESSO_OLED_POWER); /* OLED 11V power */ (void)lpc17_configgpio(LPCXPRESSO_OLED_DC); /* OLED Command/Data */ - oleddc_dumpgpio("up_nxdrvinit: After OLED Power/DC setup"); + oleddc_dumpgpio("board_graphics_setup: After OLED Power/DC setup"); /* Get the SPI1 port (configure as a Freescale SPI port) */ diff --git a/nuttx/configs/olimex-lpc1766stk/src/lpc17_lcd.c b/nuttx/configs/olimex-lpc1766stk/src/lpc17_lcd.c index 4fa4d400d..180743ce3 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/lpc17_lcd.c +++ b/nuttx/configs/olimex-lpc1766stk/src/lpc17_lcd.c @@ -44,6 +44,7 @@ #include <errno.h> #include <nuttx/arch.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/nokia6100.h> @@ -176,24 +177,24 @@ void nokia_blinitialize(void) ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called NX initialization logic to configure the LCD. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; /* Configure the LCD GPIOs */ - lcd_dumpgpio("up_nxdrvinit: On entry"); + lcd_dumpgpio("board_graphics_setup: On entry"); lpc17_configgpio(LPC1766STK_LCD_RST); lpc17_configgpio(LPC1766STK_LCD_BL); - lcd_dumpgpio("up_nxdrvinit: After GPIO setup"); + lcd_dumpgpio("board_graphics_setup: After GPIO setup"); /* Reset the LCD */ diff --git a/nuttx/configs/sam4l-xplained/src/sam_ug2832hsweg04.c b/nuttx/configs/sam4l-xplained/src/sam_ug2832hsweg04.c index 10000eb5e..9d5685550 100644 --- a/nuttx/configs/sam4l-xplained/src/sam_ug2832hsweg04.c +++ b/nuttx/configs/sam4l-xplained/src/sam_ug2832hsweg04.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sam4l-xplained/src/sam_ug2832hsweg04.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -80,6 +80,7 @@ #include <debug.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/ssd1306.h> @@ -126,14 +127,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; diff --git a/nuttx/configs/samd20-xplained/src/sam_ug2832hsweg04.c b/nuttx/configs/samd20-xplained/src/sam_ug2832hsweg04.c index bc6fde097..52ac01971 100644 --- a/nuttx/configs/samd20-xplained/src/sam_ug2832hsweg04.c +++ b/nuttx/configs/samd20-xplained/src/sam_ug2832hsweg04.c @@ -110,6 +110,7 @@ #include <debug.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/ssd1306.h> @@ -156,14 +157,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; diff --git a/nuttx/configs/stm32f4discovery/src/stm32_ug2864ambag01.c b/nuttx/configs/stm32f4discovery/src/stm32_ug2864ambag01.c index fdc6b88f3..ce735389a 100644 --- a/nuttx/configs/stm32f4discovery/src/stm32_ug2864ambag01.c +++ b/nuttx/configs/stm32f4discovery/src/stm32_ug2864ambag01.c @@ -41,6 +41,7 @@ #include <debug.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/ug-2864ambag01.h> @@ -105,14 +106,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; diff --git a/nuttx/configs/stm32f4discovery/src/stm32_ug2864hsweg01.c b/nuttx/configs/stm32f4discovery/src/stm32_ug2864hsweg01.c index 3366b093d..27db6391a 100644 --- a/nuttx/configs/stm32f4discovery/src/stm32_ug2864hsweg01.c +++ b/nuttx/configs/stm32f4discovery/src/stm32_ug2864hsweg01.c @@ -41,6 +41,7 @@ #include <debug.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/ssd1306.h> @@ -105,14 +106,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; diff --git a/nuttx/configs/zp214xpa/src/lpc2148_ug2864ambag01.c b/nuttx/configs/zp214xpa/src/lpc2148_ug2864ambag01.c index 398fc2c51..d74a035c0 100644 --- a/nuttx/configs/zp214xpa/src/lpc2148_ug2864ambag01.c +++ b/nuttx/configs/zp214xpa/src/lpc2148_ug2864ambag01.c @@ -41,6 +41,7 @@ #include <debug.h> +#include <nuttx/board.h> #include <nuttx/spi/spi.h> #include <nuttx/lcd/lcd.h> #include <nuttx/lcd/ug-2864ambag01.h> @@ -110,14 +111,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_nxdrvinit + * Name: board_graphics_setup * * Description: * Called by NX initialization logic to configure the OLED. * ****************************************************************************/ -FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; diff --git a/nuttx/graphics/Kconfig b/nuttx/graphics/Kconfig index 984c42274..dec4ce5d6 100644 --- a/nuttx/graphics/Kconfig +++ b/nuttx/graphics/Kconfig @@ -675,9 +675,10 @@ config NXSTART_EXTERNINIT ---help--- Define to support external display initialization by platform- specific code. This this option is defined, then nx_start() will - call up_nxdrvinit(CONFIG_NXSTART_DEVNO) to initialize the graphics - device. This option is necessary if display is used that cannot be - initialized using the standard LCD or framebuffer interfaces. + call board_graphics_setup(CONFIG_NXSTART_DEVNO) to initialize the + graphics device. This option is necessary if display is used that + cannot be initialized using the standard LCD or framebuffer + interfaces. config NXSTART_SERVERPRIO int "NX Server priority" diff --git a/nuttx/graphics/nxmu/nx_start.c b/nuttx/graphics/nxmu/nx_start.c index f11d4c5de..589557013 100644 --- a/nuttx/graphics/nxmu/nx_start.c +++ b/nuttx/graphics/nxmu/nx_start.c @@ -45,6 +45,7 @@ #include <errno.h> #include <debug.h> +#include <nuttx/board.h> #include <nuttx/kthread.h> #include <nuttx/nx/nx.h> @@ -96,10 +97,10 @@ int nx_server(int argc, char *argv[]) #if defined(CONFIG_NXSTART_EXTERNINIT) /* Use external graphics driver initialization */ - dev = up_nxdrvinit(CONFIG_NXSTART_DEVNO); + dev = board_graphics_setup(CONFIG_NXSTART_DEVNO); if (!dev) { - gdbg("ERROR: up_nxdrvinit failed, devno=%d\n", CONFIG_NXSTART_DEVNO); + gdbg("ERROR: board_graphics_setup failed, devno=%d\n", CONFIG_NXSTART_DEVNO); return EXIT_FAILURE; } diff --git a/nuttx/include/nuttx/board.h b/nuttx/include/nuttx/board.h index 80ec312c6..643a164c0 100644 --- a/nuttx/include/nuttx/board.h +++ b/nuttx/include/nuttx/board.h @@ -208,6 +208,29 @@ void board_tsc_teardown(void); int board_adc_setup(void); /**************************************************************************** + * Name: board_graphics_setup + * + * Description: + * If the driver for the graphics device on the platform some unusual + * initialization, then this board interface should be provided. + * + * This is an internal OS interface but may be invoked indirectly from + * application-level graphics logic. If CONFIG_LIB_BOARDCTL=y and + * CONFIG_BOARDCTL_GRAPHICS=y, then this functions will be invoked via the + * (non-standard) boardctl() interface using the commands + * BOARDIOC_GRAPHICS_SETUP command. + * + ****************************************************************************/ + +#ifdef CONFIG_NX_LCDDRIVER +struct lcd_dev_s; +FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno); +#else +struct fb_vtable_s; +FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno); +#endif + +/**************************************************************************** * Name: board_ioctl * * Description: diff --git a/nuttx/include/sys/boardctl.h b/nuttx/include/sys/boardctl.h index 8da574ec3..5b6741570 100644 --- a/nuttx/include/sys/boardctl.h +++ b/nuttx/include/sys/boardctl.h @@ -76,12 +76,19 @@ * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_ADCTEST * DEPENDENCIES: Board logic must provide board_adc_setup() * + * CMD: BOARDIOC_GRAPHICS_SETUP + * DESCRIPTION: Configure graphics that require special initialization + * procedures + * ARG: A pointer to an instance of struct boardioc_graphics_s + * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_GRAPHICS + * DEPENDENCIES: Board logic must provide board_adc_setup() */ #define BOARDIOC_INIT _BOARDIOC(0x0001) #define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0002) #define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0003) #define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0004) +#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0005) /* If CONFIG_BOARDCTL_IOCTL=y, then boad-specific commands will be support. * In this case, all commands not recognized by boardctl() will be forwarded @@ -90,12 +97,32 @@ * User defined board commands may begin with this value: */ -#define BOARDIOC_USER _BOARDIOC(0x0005) +#define BOARDIOC_USER _BOARDIOC(0x0006) /**************************************************************************** * Public Type Definitions ****************************************************************************/ +/* Structure used to pass arguments and get returned values from the + * BOARDIOC_GRAPHICS_SETUP command. + */ + +#ifdef CONFIG_NX_LCDDRIVER +struct lcd_dev_s; /* Forward reference */ +#else +struct fb_vtable_s; /* Forward reference */ +#endif + +struct boardioc_graphics_s +{ + int devno; /* IN: Graphics device number */ +#ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *dev; /* OUT: LCD driver instance */ +#else + FAR struct fb_vtable_s *dev; /* OUT: Framebuffer driver instance */ +#endif +}; + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ |