diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-17 03:08:30 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-17 03:08:30 +0000 |
commit | 7acedfe75789174106ff09483c82b5edf527c076 (patch) | |
tree | bfd2bca94b6e3f013162a2ff47a3403a2c017575 /nuttx | |
parent | 16ae1294c4dfb7465564eb5fa97fdeda1f3fcb21 (diff) | |
download | px4-nuttx-7acedfe75789174106ff09483c82b5edf527c076.tar.gz px4-nuttx-7acedfe75789174106ff09483c82b5edf527c076.tar.bz2 px4-nuttx-7acedfe75789174106ff09483c82b5edf527c076.zip |
Generalize graphics driver type
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2597 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/graphics/nxbe/Make.defs | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe.h | 15 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_colormap.c | 6 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_configure.c (renamed from nuttx/graphics/nxbe/nxbe_fbconfigure.c) | 8 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxfe.h | 3 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxmu_server.c | 27 | ||||
-rw-r--r-- | nuttx/graphics/nxsu/nx_open.c | 18 | ||||
-rw-r--r-- | nuttx/graphics/nxsu/nxfe.h | 3 | ||||
-rwxr-xr-x | nuttx/include/nuttx/lcd.h | 1 | ||||
-rw-r--r-- | nuttx/include/nuttx/nx.h | 30 |
10 files changed, 63 insertions, 50 deletions
diff --git a/nuttx/graphics/nxbe/Make.defs b/nuttx/graphics/nxbe/Make.defs index 98aaf2097..2f9388fc0 100644 --- a/nuttx/graphics/nxbe/Make.defs +++ b/nuttx/graphics/nxbe/Make.defs @@ -34,7 +34,7 @@ ############################################################################ NXBE_ASRCS = -NXBE_CSRCS = nxbe_fbconfigure.c nxbe_colormap.c nxbe_clipper.c \ +NXBE_CSRCS = nxbe_configure.c nxbe_colormap.c nxbe_clipper.c \ nxbe_closewindow.c \ nxbe_setposition.c nxbe_setsize.c nxbe_raise.c nxbe_lower.c \ nxbe_fill.c nxbe_filltrapezoid.c nxbe_move.c nxbe_bitmap.c \ diff --git a/nuttx/graphics/nxbe/nxbe.h b/nuttx/graphics/nxbe/nxbe.h index f9b36c0a3..3dec64b02 100644 --- a/nuttx/graphics/nxbe/nxbe.h +++ b/nuttx/graphics/nxbe/nxbe.h @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxbe/nxbe.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 @@ -44,7 +44,8 @@ #include <stdint.h> #include <stdbool.h> -#include <nuttx/fb.h> + +#include <nuttx/nx.h> #include <nuttx/nxglib.h> /**************************************************************************** @@ -211,20 +212,20 @@ extern "C" { ****************************************************************************/ #if CONFIG_FB_CMAP -EXTERN int nxbe_colormap(FAR struct fb_vtable_s *fb); +EXTERN int nxbe_colormap(FAR struct NX_DRIVERTYPE *dev); #endif /**************************************************************************** - * Name: nx_fbconfigure + * Name: nx_configure * * Description: * Configure the back end state structure based on information from the - * framebuffer driver + * framebuffer or LCD driver * ****************************************************************************/ -EXTERN int nxbe_fbconfigure(FAR struct fb_vtable_s *fb, - FAR struct nxbe_state_s *be); +EXTERN int nxbe_configure(FAR NX_DRIVERTYPE *dev, + FAR struct nxbe_state_s *be); /**************************************************************************** * Name: nxbe_closewindow diff --git a/nuttx/graphics/nxbe/nxbe_colormap.c b/nuttx/graphics/nxbe/nxbe_colormap.c index 25a493d1d..f35393b20 100644 --- a/nuttx/graphics/nxbe/nxbe_colormap.c +++ b/nuttx/graphics/nxbe/nxbe_colormap.c @@ -45,8 +45,6 @@ #include <errno.h> #include <debug.h> -#include <nuttx/fb.h> - #include "nxbe.h" /**************************************************************************** @@ -82,7 +80,7 @@ ****************************************************************************/ #if CONFIG_FB_CMAP -int nxbe_colormap(FAR struct fb_vtable_s *fb) +int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be) { struct fb_cmap_s cmap; uint8_t *alloc; @@ -143,7 +141,7 @@ int nxbe_colormap(FAR struct fb_vtable_s *fb) /* Then set the color map */ - ret =fb->putcmap(fb, &cmap); + ret = dev->putcmap(dev, &cmap); free(alloc); return ret; diff --git a/nuttx/graphics/nxbe/nxbe_fbconfigure.c b/nuttx/graphics/nxbe/nxbe_configure.c index df6dbe0d9..0d5aeefdc 100644 --- a/nuttx/graphics/nxbe/nxbe_fbconfigure.c +++ b/nuttx/graphics/nxbe/nxbe_configure.c @@ -1,7 +1,7 @@ /**************************************************************************** - * graphics/nxbe/nxbe_fbconfigure.c + * graphics/nxbe/nxbe_configure.c * - * 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 @@ -70,7 +70,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: nxbe_fbconfigure + * Name: nxbe_configure * * Description: * Configure the back end state structure based on information from the @@ -78,7 +78,7 @@ * ****************************************************************************/ -int nxbe_fbconfigure(FAR struct fb_vtable_s *fb, FAR struct nxbe_state_s *be) +int nxbe_configure(FAR struct fb_vtable_s *fb, FAR struct nxbe_state_s *be) { int ret; int i; diff --git a/nuttx/graphics/nxmu/nxfe.h b/nuttx/graphics/nxmu/nxfe.h index e449dc10e..f228c9029 100644 --- a/nuttx/graphics/nxmu/nxfe.h +++ b/nuttx/graphics/nxmu/nxfe.h @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxmu/nxfe.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 @@ -47,7 +47,6 @@ #include <mqueue.h> #include <semaphore.h> -#include <nuttx/fb.h> #include <nuttx/nx.h> #include "nxbe.h" diff --git a/nuttx/graphics/nxmu/nxmu_server.c b/nuttx/graphics/nxmu/nxmu_server.c index d9ff97534..24132a17f 100644 --- a/nuttx/graphics/nxmu/nxmu_server.c +++ b/nuttx/graphics/nxmu/nxmu_server.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxmu/nxmu_server.c * - * 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 @@ -48,7 +48,6 @@ #include <errno.h> #include <debug.h> -#include <nuttx/fb.h> #include <nuttx/nx.h> #include "nxfe.h" @@ -181,34 +180,34 @@ static inline void nxmu_shutdown(FAR struct nxfe_state_s *fe) * Name: nxmu_setup ****************************************************************************/ -static inline int nxmu_setup(FAR const char *mqname, - FAR struct fb_vtable_s *fb, - FAR struct nxfe_state_s *fe) +static inline int nxmu_lcdsetup(FAR const char *mqname, + FAR NX_DRIVERTYPE *dev, + FAR struct nxfe_state_s *fe) { struct mq_attr attr; int ret; memset(fe, 0, sizeof(struct nxfe_state_s)); - /* Configure the framebuffer device */ + /* Configure the framebuffer/LCD device */ - ret = nxbe_fbconfigure(fb, &fe->be); + ret = nxbe_configure(dev, &fe->be); if (ret < 0) { - gdbg("nxbe_fbconfigure failed: %d\n", -ret); + gdbg("nxbe_configure failed: %d\n", -ret); errno = -ret; return ERROR; } #if CONFIG_FB_CMAP - ret = nxbe_colormap(fb); + ret = nxbe_colormap(dev); if (ret < 0) { gdbg("nxbe_colormap failed: %d\n", -ret); errno = -ret; return ERROR; } -#endif +#endif /* CONFIG_FB_CMAP */ /* Initialize the non-NULL elements of the server connection structure. * Oddly, this strcture represents the connection between the server and @@ -289,7 +288,7 @@ static inline int nxmu_setup(FAR const char *mqname, * * Input Parameters: * mqname - The name for the server incoming message queue - * fb - Vtable "object" of the framebuffer "driver" to use + * dev - Vtable "object" of the framebuffer/LCD "driver" to use * * Return: * This function usually does not return. If it does return, it will @@ -297,7 +296,7 @@ static inline int nxmu_setup(FAR const char *mqname, * ****************************************************************************/ -int nx_runinstance(FAR const char *mqname, FAR struct fb_vtable_s *fb) +int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev) { struct nxfe_state_s fe; FAR struct nxsvrmsg_s *msg; @@ -310,7 +309,7 @@ int nx_runinstance(FAR const char *mqname, FAR struct fb_vtable_s *fb) /* Sanity checking */ #ifdef CONFIG_DEBUG - if (!mqname || !fb) + if (!mqname || !dev) { errno = EINVAL; return ERROR; @@ -319,7 +318,7 @@ int nx_runinstance(FAR const char *mqname, FAR struct fb_vtable_s *fb) /* Initialize and configure the server */ - ret = nxmu_setup(mqname, fb, &fe); + ret = nxmu_setup(mqname, dev, &fe); if (ret < 0) { return ret; /* nxmu_setup sets errno */ diff --git a/nuttx/graphics/nxsu/nx_open.c b/nuttx/graphics/nxsu/nx_open.c index cde501f15..3ba3e6029 100644 --- a/nuttx/graphics/nxsu/nx_open.c +++ b/nuttx/graphics/nxsu/nx_open.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxsu/nx_open.c * - * 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 @@ -108,23 +108,23 @@ static void nxsu_bkgdredraw(NXWINDOW hwnd, * Name: nxsu_setup ****************************************************************************/ -static inline int nxsu_setup(FAR struct fb_vtable_s *fb, +static inline int nxsu_setup(FAR NX_DRIVERTYPE *dev, FAR struct nxfe_state_s *fe) { int ret; /* Configure the framebuffer device */ - ret = nxbe_fbconfigure(fb, &fe->be); + ret = nxbe_configure(dev, &fe->be); if (ret < 0) { - gdbg("nxbe_fbconfigure failed: %d\n", -ret); + gdbg("nxbe_configure failed: %d\n", -ret); errno = -ret; return ERROR; } #if CONFIG_FB_CMAP - ret = nxbe_colormap(fb); + ret = nxbe_colormap(dev); if (ret < 0) { gdbg("nxbe_colormap failed: %d\n", -ret); @@ -170,7 +170,7 @@ static inline int nxsu_setup(FAR struct fb_vtable_s *fb, * plus nx_run. * * Input Parameters: - * fb - Vtable "object" of the framebuffer "driver" to use + * dev - Vtable "object" of the framebuffer/LCD "driver" to use * * Return: * Success: A non-NULL handle used with subsequent NX accesses @@ -178,7 +178,7 @@ static inline int nxsu_setup(FAR struct fb_vtable_s *fb, * ****************************************************************************/ -NXHANDLE nx_open(FAR struct fb_vtable_s *fb) +NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev) { FAR struct nxfe_state_s *fe; int ret; @@ -186,7 +186,7 @@ NXHANDLE nx_open(FAR struct fb_vtable_s *fb) /* Sanity checking */ #ifdef CONFIG_DEBUG - if (!fb) + if (!dev) { errno = EINVAL; return NULL; @@ -204,7 +204,7 @@ NXHANDLE nx_open(FAR struct fb_vtable_s *fb) /* Initialize and configure the server */ - ret = nxsu_setup(fb, fe); + ret = nxsu_setup(dev, fe); if (ret < 0) { return NULL; /* nxsu_setup sets errno */ diff --git a/nuttx/graphics/nxsu/nxfe.h b/nuttx/graphics/nxsu/nxfe.h index acfa5e122..aa9fb49a9 100644 --- a/nuttx/graphics/nxsu/nxfe.h +++ b/nuttx/graphics/nxsu/nxfe.h @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxsu/nxfe.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,6 @@ #include <mqueue.h> #include <semaphore.h> -#include <nuttx/fb.h> #include <nuttx/nx.h> #include "nxbe.h" diff --git a/nuttx/include/nuttx/lcd.h b/nuttx/include/nuttx/lcd.h index aee8d1dd2..dbb3fdf75 100755 --- a/nuttx/include/nuttx/lcd.h +++ b/nuttx/include/nuttx/lcd.h @@ -65,6 +65,7 @@ struct lcd_planeinfo_s int (*putrun)(struct lcd_dev_s *dev, unsigned int planeno, fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, size_t npixels); + int (*getrun)(struct lcd_dev_s *dev, unsigned int planeno, fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, size_t npixels); diff --git a/nuttx/include/nuttx/nx.h b/nuttx/include/nuttx/nx.h index edc30c0d4..20e0c517d 100644 --- a/nuttx/include/nuttx/nx.h +++ b/nuttx/include/nuttx/nx.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/nx.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 @@ -44,7 +44,13 @@ #include <stdint.h> #include <stdbool.h> -#include <nuttx/fb.h> + +#ifdef CONFIG_NX_LCDDRIVER +# include <nuttx/lcd.h> +#else +# include <nuttx/fb.h> +#endif + #include <nuttx/nxglib.h> /**************************************************************************** @@ -62,6 +68,16 @@ #define NX_MOUSE_CENTERBUTTON 0x02 #define NX_MOUSE_RIGHTBUTTON 0x04 +/* NX_DRIVERTYPE selects either the framebuffer or LCD driver. A define is + * used instead of a typedef to avoid type mismatches. + */ + +#ifdef CONFIG_NX_LCDDRIVER +# define NX_DRIVERTYPE struct lcd_dev_s +#else +# define NX_DRIVERTYPE struct fb_vtable_s +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -215,7 +231,7 @@ extern "C" { * * Input Parameters: * mqname - The name for the server incoming message queue - * fb - Vtable "object" of the framebuffer "driver" to use + * dev - Vtable "object" of the framebuffer "driver" to use * * Return: * This function usually does not return. If it does return, it will @@ -224,8 +240,8 @@ extern "C" { ****************************************************************************/ #ifdef CONFIG_NX_MULTIUSER -EXTERN int nx_runinstance(FAR const char *mqname, FAR struct fb_vtable_s *fb); -# define nx_run(fb) nx_runinstance(NX_DEFAULT_SERVER_MQNAME, fb) +EXTERN int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev); +# define nx_run(dev) nx_runinstance(NX_DEFAULT_SERVER_MQNAME, dev) #endif /**************************************************************************** @@ -273,7 +289,7 @@ EXTERN NXHANDLE nx_connectinstance(FAR const char *svrmqname); * Single user mode only! * * Input Parameters: - * fb - Vtable "object" of the framebuffer "driver" to use + * dev - Vtable "object" of the framebuffer/LCD "driver" to use * cb - Callbacks used to process received NX server messages * * Return: @@ -283,7 +299,7 @@ EXTERN NXHANDLE nx_connectinstance(FAR const char *svrmqname); ****************************************************************************/ #ifndef CONFIG_NX_MULTIUSER -EXTERN NXHANDLE nx_open(FAR struct fb_vtable_s *fb); +EXTERN NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev); #endif /**************************************************************************** |