mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
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
This commit is contained in:
@@ -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,
|
||||
|
||||
+45
-6
@@ -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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -483,6 +483,27 @@ EXTERN int up_fbinitialize(void);
|
||||
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
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/fb.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
|
||||
****************************************************************************/
|
||||
|
||||
+51
-30
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user