diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-17 14:46:13 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-17 14:46:13 +0000 |
commit | 6fb154273f6cdb31738b54a3f9a513b944d20813 (patch) | |
tree | 9d8c28c160258d8a8c76bdd6751c85175b05795a | |
parent | 3facd1246f2a57f2b78c3e16521803c62c8394f4 (diff) | |
download | nuttx-6fb154273f6cdb31738b54a3f9a513b944d20813.tar.gz nuttx-6fb154273f6cdb31738b54a3f9a513b944d20813.tar.bz2 nuttx-6fb154273f6cdb31738b54a3f9a513b944d20813.zip |
1st round of fixes for LCD build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2604 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/examples/nx/nx_internal.h | 4 | ||||
-rw-r--r-- | nuttx/examples/nx/nx_main.c | 51 | ||||
-rwxr-xr-x | nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c | 3 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_bitblit.h | 2 | ||||
-rw-r--r-- | nuttx/include/nuttx/arch.h | 21 | ||||
-rwxr-xr-x | nuttx/include/nuttx/lcd.h | 1 | ||||
-rw-r--r-- | nuttx/include/nuttx/nx.h | 19 | ||||
-rw-r--r-- | nuttx/include/nuttx/nxglib.h | 81 |
8 files changed, 124 insertions, 58 deletions
diff --git a/nuttx/examples/nx/nx_internal.h b/nuttx/examples/nx/nx_internal.h index cb94e8dd7..c86e8cf61 100644 --- a/nuttx/examples/nx/nx_internal.h +++ b/nuttx/examples/nx/nx_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nx/nx_internal.h * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -192,6 +192,8 @@ enum exitcode_e NXEXIT_PTHREADCREATE, NXEXIT_FBINITIALIZE, NXEXIT_FBGETVPLANE, + NXEXIT_LCDINITIALIZE, + NXEXIT_LCDGETDEV, NXEXIT_NXOPEN, NXEXIT_NXOPENTOOLBAR, NXEXIT_NXCONNECT, diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c index a07bfd3c4..0104c4291 100644 --- a/nuttx/examples/nx/nx_main.c +++ b/nuttx/examples/nx/nx_main.c @@ -51,7 +51,12 @@ #include <errno.h> #include <debug.h> -#include <nuttx/fb.h> +#ifdef CONFIG_NX_LCDDRIVER +# include <nuttx/lcd.h> +#else +# include <nuttx/fb.h> +#endif + #include <nuttx/arch.h> #include <nuttx/nx.h> #include <nuttx/nxtk.h> @@ -60,9 +65,22 @@ #include "nx_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ +/* If not specified, assume that the hardware supports one video plane */ + +#ifndef CONFIG_EXAMPLES_NX_VPLANE +# define CONFIG_EXAMPLES_NX_VPLANE 0 +#endif + +/* If not specified, assume that the hardware supports one LCD device */ + +#ifndef CONFIG_EXAMPLES_NX_DEVNO +# define CONFIG_EXAMPLES_NX_DEVNO 0 +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -398,9 +416,29 @@ static inline int nxeg_raise(NXEGWINDOW hwnd) #ifndef CONFIG_NX_MULTIUSER static inline int nxeg_suinitialize(void) { - FAR struct fb_vtable_s *fb; + FAR NX_DRIVERTYPE *dev; int ret; +#ifdef CONFIG_NX_LCDDRIVER + /* Initialize the LCD device */ + + message("nxeg_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nxeg_initialize: up_lcdinitialize failed: %d\n", -ret); + g_exitcode = NXEXIT_LCDINITIALIZE; + return ERROR; + } + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO); + if (!dev) + { + message("nxeg_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + g_exitcode = NXEXIT_LCDGETDEV; + return ERROR; + } +#else /* Initialize the frame buffer device */ message("nxeg_initialize: Initializing framebuffer\n"); @@ -412,18 +450,19 @@ static inline int nxeg_suinitialize(void) return ERROR; } - fb = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); - if (!fb) + dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); + if (!dev) { message("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); g_exitcode = NXEXIT_FBGETVPLANE; return ERROR; } +#endif /* Then open NX */ message("nxeg_initialize: Open NX\n"); - g_hnx = nx_open(fb); + g_hnx = nx_open(dev); if (!g_hnx) { message("user_start: nx_open failed: %d\n", errno); diff --git a/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c index 430f9cab6..79b448d2b 100755 --- a/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c +++ b/nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <sys/types.h> #include <stdint.h> #include <nuttx/lcd.h> @@ -100,7 +101,7 @@ void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) for (col = 0; col < ncols; col++) { #if NXGLIB_BITSPERPIXEL < 8 -#elif +#else g_runbuffer #endif } diff --git a/nuttx/graphics/nxglib/nxglib_bitblit.h b/nuttx/graphics/nxglib/nxglib_bitblit.h index 27a4ee37d..9d04f8c78 100644 --- a/nuttx/graphics/nxglib/nxglib_bitblit.h +++ b/nuttx/graphics/nxglib/nxglib_bitblit.h @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxglib_bitblit.h * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index f7e7738aa..ec71cb1f0 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -484,6 +484,27 @@ EXTERN FAR struct fb_vtable_s *up_fbgetvplane(int vplane); EXTERN void fb_uninitialize(void); /**************************************************************************** + * Name: up_lcdinitialize, up_lcdgetdev, up_lcduninitialize + * + * Description: + * If an architecture supports a parallel or serial LCD, then it must + * provide APIs to access the LCD as follows: + * + * up_lcdinitialize - Initialize the video hardware + * up_lcdgetdev - Return a a reference to the LCD object for + * the specified LCD. This allows support for + * multiple LCD devices. + * up_lcduninitialize - Unitialize the framebuffer support + * + ***************************************************************************/ + +struct lcd_dev_s; /* See nuttx/lcd.h */ + +EXTERN int up_lcdinitialize(void); +EXTERN FAR struct lcd_dev_s *up_lcdgetdev(int lcdddev); +EXTERN void up_lcduninitialize(void); + +/**************************************************************************** * These are standard interfaces that are exported by the OS * for use by the architecture specific logic ****************************************************************************/ diff --git a/nuttx/include/nuttx/lcd.h b/nuttx/include/nuttx/lcd.h index d902e8d19..612fa6ed2 100755 --- a/nuttx/include/nuttx/lcd.h +++ b/nuttx/include/nuttx/lcd.h @@ -40,6 +40,7 @@ * Included Files ****************************************************************************/ +#include <sys/types.h> #include <stdint.h> #include <nuttx/fb.h> diff --git a/nuttx/include/nuttx/nx.h b/nuttx/include/nuttx/nx.h index 1392367b1..8f08de678 100644 --- a/nuttx/include/nuttx/nx.h +++ b/nuttx/include/nuttx/nx.h @@ -45,12 +45,6 @@ #include <stdint.h> #include <stdbool.h> -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd.h> -#else -# include <nuttx/fb.h> -#endif - #include <nuttx/nxglib.h> /**************************************************************************** @@ -68,19 +62,6 @@ #define NX_MOUSE_CENTERBUTTON 0x02 #define NX_MOUSE_RIGHTBUTTON 0x04 -/* NX_DRIVERTYPE selects either the framebuffer or LCD driver; NX_PLANINFO_TYPE - * hides the difference in the framebuffer and LCD driver plane types. defines - * are used instead of a typedefs to avoid type mismatches. - */ - -#ifdef CONFIG_NX_LCDDRIVER -# define NX_DRIVERTYPE struct lcd_dev_s -# define NX_PLANEINFOTYPE struct lcd_planeinfo_s -#else -# define NX_DRIVERTYPE struct fb_vtable_s -# define NX_PLANEINFOTYPE struct fb_planeinfo_s -#endif - /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/nuttx/include/nuttx/nxglib.h b/nuttx/include/nuttx/nxglib.h index 2e3539837..cf9f40133 100644 --- a/nuttx/include/nuttx/nxglib.h +++ b/nuttx/include/nuttx/nxglib.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/nxglib.h * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,12 @@ #include <stdint.h> #include <stdbool.h> #include <fixedmath.h> -#include <nuttx/fb.h> + +#ifdef CONFIG_NX_LCDDRIVER +# include <nuttx/lcd.h> +#else +# include <nuttx/fb.h> +#endif /**************************************************************************** * Pre-processor definitions @@ -57,6 +62,22 @@ # define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */ #endif +/* Driver Selection *********************************************************/ +/* NX_DRIVERTYPE selects either the framebuffer or LCD driver; + * NX_PLANINFO_TYPE hides the difference in the framebuffer and LCD driver + * plane types. defines are used instead of a typedefs to avoid type + * mismatches. + */ + +#ifdef CONFIG_NX_LCDDRIVER +# define NX_DRIVERTYPE struct lcd_dev_s +# define NX_PLANEINFOTYPE struct lcd_planeinfo_s +#else +# define NX_DRIVERTYPE struct fb_vtable_s +# define NX_PLANEINFOTYPE struct fb_planeinfo_s +#endif + +/* NXGL Macros **************************************************************/ /* Mnemonics for indices */ #define NX_TOP_NDX (0) @@ -197,25 +218,25 @@ EXTERN void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, * ****************************************************************************/ -EXTERN void nxgl_fillrectangle_1bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); -EXTERN void nxgl_fillrectangle_2bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); -EXTERN void nxgl_fillrectangle_4bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); -EXTERN void nxgl_fillrectangle_8bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); -EXTERN void nxgl_fillrectangle_16bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); -EXTERN void nxgl_fillrectangle_24bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); -EXTERN void nxgl_fillrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_fillrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color); @@ -229,31 +250,31 @@ EXTERN void nxgl_fillrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, * ****************************************************************************/ -EXTERN void nxgl_filltrapezoid_1bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_1bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); -EXTERN void nxgl_filltrapezoid_2bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_2bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); -EXTERN void nxgl_filltrapezoid_4bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_4bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); -EXTERN void nxgl_filltrapezoid_8bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_8bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); -EXTERN void nxgl_filltrapezoid_16bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_16bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); -EXTERN void nxgl_filltrapezoid_24bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_24bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); -EXTERN void nxgl_filltrapezoid_32bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_filltrapezoid_32bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_rect_s *bounds, nxgl_mxpixel_t color); @@ -267,25 +288,25 @@ EXTERN void nxgl_filltrapezoid_32bpp(FAR struct fb_planeinfo_s *pinfo, * ****************************************************************************/ -EXTERN void nxgl_moverectangle_1bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_2bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_4bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_8bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_16bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_24bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_moverectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *rect, FAR struct nxgl_point_s *offset); @@ -298,37 +319,37 @@ EXTERN void nxgl_moverectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, * ****************************************************************************/ -EXTERN void nxgl_copyrectangle_1bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride); -EXTERN void nxgl_copyrectangle_2bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride); -EXTERN void nxgl_copyrectangle_4bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride); -EXTERN void nxgl_copyrectangle_8bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride); -EXTERN void nxgl_copyrectangle_16bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride); -EXTERN void nxgl_copyrectangle_24bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride); -EXTERN void nxgl_copyrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, +EXTERN void nxgl_copyrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, FAR const struct nxgl_rect_s *dest, FAR const void *src, FAR const struct nxgl_point_s *origin, |