Generalize graphics driver type
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2597 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
8ac830d057
commit
4d33eea391
@ -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 \
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
@ -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"
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user