merge changes for exstubs.h from rel-3-2 manually

This commit is contained in:
Vincent Wei
2019-04-07 16:56:43 +08:00
parent a407f36975
commit e5255d13e1
13 changed files with 228 additions and 128 deletions

View File

@@ -1520,10 +1520,14 @@ dnl ;;
dnl esac
AC_ARG_WITH(targetname,
[ --with-targetname=unknown/customer/fmsoft/mstudio/stb810/vfanvil/vxi386/qvfb/fbcon/mx21/monaco/c33l05/bfin/vxppc/
[ --with-targetname=unknown/external/fmsoft/mstudio/stb810/vfanvil/vxi386/qvfb/fbcon/mx21/monaco/c33l05/bfin/vxppc/
S3C6410/S3C2440/S3C2410/hi3560a Define the target board name])
case "$with_targetname" in
external)
AC_DEFINE(__TARGET_EXTERNAL__, 1,
[Define for targets which use GAL and/or IAL engines and define the interfaces externally])
;;
fmsoft)
AC_DEFINE(__TARGET_FMSOFT__, 1,
[Define for FMSoft internal use])

View File

@@ -10,9 +10,9 @@ libminiguiincludedir = $(includedir)/minigui
COMM_HDRS = \
common.h endianrw.h fixedmath.h \
minigui.h gdi.h window.h control.h \
own_malloc.h own_stdio.h \
xvfb.h customial.h \
dti.c
own_malloc.h own_stdio.h \
xvfb.h customial.h exstubs.h \
dti.c
UCOSII_HDRS=ucos2_pthread.h ucos2_semaphore.h
THREADX_HDRS=threadx_pthread.h threadx_semaphore.h
@@ -23,12 +23,12 @@ OSE_HDRS=ose_semaphore.h
PSOS_HDRS=psos_pthread.h psos_semaphore.h
EXTRA_DIST=$(UCOSII_HDRS) $(THREADX_HDRS) $(NUCLEUS_HDRS) $(VXWORKS_HDRS) \
$(OSE_HDRS) $(PSOS_HDRS) $(WIN32_HDRS) makefile.ng makefile.msvc
$(OSE_HDRS) $(PSOS_HDRS) $(WIN32_HDRS) makefile.ng makefile.msvc
#CLEANFILES=pthread.h semaphore.h
libminiguiinclude_HEADERS=$(COMM_HDRS) $(UCOSII_HDRS) $(THREADX_HDRS) \
$(NUCLEUS_HDRS) $(VXWORKS_HDRS) $(OSE_HDRS) $(PSOS_HDRS) $(WIN32_HDRS)
$(NUCLEUS_HDRS) $(VXWORKS_HDRS) $(OSE_HDRS) $(PSOS_HDRS) $(WIN32_HDRS)
if MGUSE_OWN_PTHREAD
install-data-local:

123
include/exstubs.h Normal file
View File

@@ -0,0 +1,123 @@
/**
* \file exstubs.h
* \author Wei Yongming <vincent@minigui.org>
* \date 2019/04/07
*
* \brief This file is the header for NEWGAL/IAL engines which should be
* implemented by an external module.
*
\verbatim
This file is part of MiniGUI, a mature cross-platform windowing
and Graphics User Interface (GUI) support system for embedded systems
and smart IoT devices.
Copyright (C) 2007~2018, Beijing FMSoft Technologies Co., Ltd.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Or,
As this program is a library, any link to this program must follow
GNU General Public License version 3 (GPLv3). If you cannot accept
GPLv3, you need to be licensed from FMSoft.
If you have got a commercial license of this program, please use it
under the terms and conditions of the commercial license.
For more information about the commercial license, please refer to
<http://www.minigui.com/en/about/licensing-policy/>.
\endverbatim
*/
/*
* MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks,
* pSOS, ThreadX, NuCleus, OSE, and Win32.
*/
#ifndef GUI_EXSTUBS_H
#define GUI_EXSTUBS_H
/* external stubs for COMMLCD NEWGAL engine */
#ifdef _MGGAL_COMMLCD
/* The pixel format defined by depth */
#define COMMLCD_PSEUDO_RGB332 1
#define COMMLCD_TRUE_RGB555 2
#define COMMLCD_TRUE_RGB565 3
#define COMMLCD_TRUE_RGB888 4
#define COMMLCD_TRUE_RGB0888 5
#define COMMLCD_TRUE_ARGB1555 6
#define COMMLCD_TRUE_ARGB8888 7
#define COMMLCD_TRUE_ABRG8888 8
#define COMMLCD_UPDATE_NONE 0
#define COMMLCD_UPDATE_SYNC 1
#define COMMLCD_UPDATE_ASYNC 2
struct commlcd_info {
int height; // vertical resolution of the screen
int width; // horinzontal resolution of the screen
int pitch; // Length of one scan line in bytes
int bpp; // Depth (bits-per-pixel)
int type; // Pixel type
int update_method; // Update method: none, asynchronously, or synchronously.
Uint8* fb; // Frame buffer
};
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int __commlcd_drv_init (void);
int __commlcd_drv_getinfo (struct commlcd_info *li,
int width, int height, int depth);
int __commlcd_drv_release (void);
int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors);
int __commlcd_drv_update (const RECT* rc_dirty);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _MGGAL_COMMLCD */
#ifdef _MGIAL_COMM
#define COMM_MOUSEINPUT 0x01
#define COMM_KBINPUT 0x02
#define COMM_MOUSELBUTTON 0x01
#define COMM_MOUSERBUTTON 0x04
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int __comminput_init (void);
int __comminput_ts_getdata (short *x, short *y, short *button);
int __comminput_kb_getdata (short *key, short *status);
int __comminput_wait_for_input (struct timeval *timeout);
void __comminput_deinit (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _MGIAL_COMM */
#endif /* GUI_EXSTUBS_H */

View File

@@ -1,39 +1,39 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* Or,
*
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
/*
** comminput.c: Common Input Engine for eCos, uC/OS-II, VxWorks, ...
**
**
** Created by Zhong Shuyi, 2004/02/29
*/
@@ -50,24 +50,9 @@
#include "comminput.h"
#define COMM_MOUSEINPUT 0x01
#define COMM_KBINPUT 0x02
#define COMM_MOUSELBUTTON 0x01
#define COMM_MOUSERBUTTON 0x04
#include "exstubs.h"
/* ----------------------------------------------------------------------- */
// OS input driver or application must implement these input functions
// hardware must be initialized before this engine can be used.
extern int __comminput_init (void);
extern int __comminput_ts_getdata (short *x, short *y, short *button);
extern int __comminput_kb_getdata (short *key, short *status);
extern int __comminput_wait_for_input (struct timeval *timeout);
extern void __comminput_deinit (void);
/* ----------------------------------------------------------------------- */
static short MOUSEX = 0, MOUSEY = 0, MOUSEBUTTON = 0;
static short KEYCODE = 0, KEYSTATUS = 0;
@@ -142,7 +127,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
else if (retvalue < 0) {
retvalue = -1;
}
return retvalue;
}

View File

@@ -208,7 +208,7 @@ static int L2F50113T00_getscreeninfo (struct commlcd_info *li, int width, int he
li->width = SCREEN_WIDTH;
li->fb = (void*)VRAM_ADDR_1;
li->bpp = LCD_BPP;
li->rlen = SCREEN_WIDTH * LCD_BPP_UNIT;
li->pitch = SCREEN_WIDTH * LCD_BPP_UNIT;
li->async_update = 0;
return 0;

View File

@@ -1,33 +1,33 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* Or,
*
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
@@ -47,6 +47,7 @@
#include "newgal.h"
#include "sysvideo.h"
#include "pixels_c.h"
#include "misc.h"
#ifdef _MGGAL_COMMLCD
@@ -78,6 +79,23 @@ static void COMMLCD_DeleteDevice(GAL_VideoDevice *device)
free (device);
}
static void COMMLCD_UpdateRects_Sync (_THIS, int numrects, GAL_Rect *rects)
{
int i;
/* sync update */
for (i = 0; i < numrects; i++) {
RECT rc;
SetRect (&rc, rects[i].x, rects[i].y,
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
if (!IsRectEmpty (&rc)) {
__mg_commlcd_ops.update (&rc);
}
}
}
static BOOL _valid_async_updater = TRUE;
static void* task_do_update (void* data)
{
_THIS;
@@ -92,41 +110,23 @@ static void* task_do_update (void* data)
this->hidden->dirty = FALSE;
}
pthread_mutex_unlock (&this->hidden->update_lock);
usleep (50*1000); /* 50 ms */
} while (1);
__mg_os_time_delay(50); /* 50 ms */
} while (_valid_async_updater);
return NULL;
}
static void COMMLCD_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
static void COMMLCD_UpdateRects_Async (_THIS, int numrects, GAL_Rect *rects)
{
int i;
RECT bound;
if (__mg_commlcd_ops.update == NULL) {
return;
}
if (this->hidden->update_th == 0) {
/* sync update */
for (i = 0; i < numrects; i++) {
RECT rc;
SetRect (&rc, rects[i].x, rects[i].y,
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
if (!IsRectEmpty (&rc)) {
__mg_commlcd_ops.update (&rc);
}
}
return;
}
pthread_mutex_lock (&this->hidden->update_lock);
bound = this->hidden->rc_dirty;
for (i = 0; i < numrects; i++) {
RECT rc;
SetRect (&rc, rects[i].x, rects[i].y,
SetRect (&rc, rects[i].x, rects[i].y,
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
if (IsRectEmpty (&bound))
bound = rc;
@@ -180,8 +180,8 @@ static GAL_VideoDevice *COMMLCD_CreateDevice (int devindex)
device->SetHWColorKey = NULL;
device->SetHWAlpha = NULL;
device->FreeHWSurface = COMMLCD_FreeHWSurface;
device->UpdateRects = COMMLCD_UpdateRects;
device->UpdateRects = NULL;
device->free = COMMLCD_DeleteDevice;
return device;
}
@@ -214,7 +214,7 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current,
int width, int height, int bpp, Uint32 flags)
{
Uint32 Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0;
struct commlcd_info li;
struct commlcd_info li;
memset (&li, 0, sizeof (struct commlcd_info));
if (__mg_commlcd_ops.getinfo (&li, width, height, bpp)) {
@@ -225,10 +225,10 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current,
this->hidden->w = li.width;
this->hidden->h = li.height;
this->hidden->pitch = li.rlen;
this->hidden->pitch = li.pitch;
this->hidden->fb = li.fb;
memset (li.fb, 0, li.rlen * height);
memset (li.fb, 0, li.pitch * height);
switch (li.type) {
case COMMLCD_PSEUDO_RGB332:
@@ -264,6 +264,12 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current,
Gmask = 0x0000FF00;
Bmask = 0x000000FF;
break;
case COMMLCD_TRUE_ABRG8888:
Amask = 0xFF000000;
Bmask = 0x00FF0000;
Rmask = 0x0000FF00;
Gmask = 0x000000FF;
break;
}
/* Allocate the new pixel format for the screen */
@@ -284,17 +290,29 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current,
current->pitch = this->hidden->pitch;
current->pixels = this->hidden->fb;
if (li.async_update && __mg_commlcd_ops.update) {
if (li.update_method == COMMLCD_UPDATE_NONE) {
this->UpdateRects = NULL;
this->hidden->update_th = 0;
}
else if (li.update_method == COMMLCD_UPDATE_ASYNC) {
this->UpdateRects = COMMLCD_UpdateRects_Async;
#if 0
pthread_attr_t new_attr;
pthread_attr_init (&new_attr);
pthread_attr_setdetachstate (&new_attr, PTHREAD_CREATE_DETACHED);
pthread_create (&this->hidden->update_th, &new_attr,
pthread_create (&this->hidden->update_th, &new_attr,
task_do_update, this);
pthread_attr_destroy (&new_attr);
#else
pthread_create (&this->hidden->update_th, NULL,
task_do_update, this);
#endif
pthread_mutex_init (&this->hidden->update_lock, NULL);
}
else {
this->UpdateRects = COMMLCD_UpdateRects_Sync;
this->hidden->update_th = 0;
}
@@ -308,8 +326,10 @@ static void COMMLCD_VideoQuit (_THIS)
this->screen->pixels = NULL;
}
if (__mg_commlcd_ops.update) {
if (this->hidden->update_th) {
/* quit the update task */
_valid_async_updater = FALSE;
pthread_join(this->hidden->update_th, NULL);
}
if (__mg_commlcd_ops.release)
@@ -318,7 +338,7 @@ static void COMMLCD_VideoQuit (_THIS)
return;
}
static GAL_Rect **COMMLCD_ListModes (_THIS, GAL_PixelFormat *format,
static GAL_Rect **COMMLCD_ListModes (_THIS, GAL_PixelFormat *format,
Uint32 flags)
{
return (GAL_Rect **) -1;
@@ -335,11 +355,11 @@ static void COMMLCD_FreeHWSurface (_THIS, GAL_Surface *surface)
surface->pixels = NULL;
}
static int COMMLCD_SetColors (_THIS, int firstcolor, int ncolors,
static int COMMLCD_SetColors (_THIS, int firstcolor, int ncolors,
GAL_Color *colors)
{
if (__mg_commlcd_ops.setclut)
return __mg_commlcd_ops.setclut (firstcolor, ncolors, colors);
return __mg_commlcd_ops.setclut (firstcolor, ncolors, colors);
return 0;
}

View File

@@ -37,6 +37,8 @@
#include "sysvideo.h"
#include "exstubs.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -56,26 +58,6 @@ struct GAL_PrivateVideoData {
pthread_mutex_t update_lock;
};
/* The pixel format defined by depth */
#define COMMLCD_PSEUDO_RGB332 1
#define COMMLCD_TRUE_RGB555 2
#define COMMLCD_TRUE_RGB565 3
#define COMMLCD_TRUE_RGB888 4
#define COMMLCD_TRUE_RGB0888 5
#define COMMLCD_TRUE_ARGB1555 6
#define COMMLCD_TRUE_ARGB8888 7
struct commlcd_info {
short height; // vertical resolution of the screen
short width; // horinzontal resolution of the screen
short bpp; // Depth (bits-per-pixel)
short type; // Pixel type
short rlen; // Length of one scan line in bytes
void *fb; // Frame buffer
short async_update; // update asynchronously or synchronously. 0 for synchronously; others for asynchronously.
};
struct commlcd_ops {
/* return value: zero for OK */
int (*init) (void);

View File

@@ -71,7 +71,7 @@ static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp)
li->width = ecos_lcd_info.width;
li->fb = ecos_lcd_info.fb;
li->bpp = ecos_lcd_info.bpp;
li->rlen = ecos_lcd_info.rlen;
li->pitch = ecos_lcd_info.pitch;
li->async_update = 0;
return 0;
}

View File

@@ -74,7 +74,7 @@ static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp)
li->height = 240;
li->width = 320;
li->bpp = 32;
li->rlen = 320 * 32 / 8;
li->pitch = 320 * 32 / 8;
li->fb = 0xe40000;
li->type = COMMLCD_TRUE_RGB0888;
return 0;

View File

@@ -1,50 +1,44 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* Or,
*
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
/*
** extern.c: A subdriver of CommonLCD NEWGAL engine for some targets
** which are defined by the external module.
** which are defined by the external module (__TARGET_EXTERNAL__).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#ifdef _MGGAL_COMMLCD
#if defined (__VXWORKS__) || defined (__TARGET_UNKNOWN__)
#if defined(_MGGAL_COMMLCD) && defined(__TARGET_EXTERNAL__)
#include "minigui.h"
#include "newgal.h"
@@ -52,12 +46,6 @@
#include "pixels_c.h"
#include "commlcd.h"
extern int __commlcd_drv_init (void);
extern int __commlcd_drv_getinfo (struct commlcd_info *li, int width, int height, int bpp);
extern int __commlcd_drv_release (void);
extern int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors);
extern int __commlcd_drv_update (const RECT* rc_dirty);
struct commlcd_ops __mg_commlcd_ops = {
__commlcd_drv_init,
__commlcd_drv_getinfo,
@@ -66,7 +54,5 @@ struct commlcd_ops __mg_commlcd_ops = {
__commlcd_drv_update
};
#endif
#endif /* _MGGAL_COMMLCD */
#endif /* _MGGAL_COMMLCD && __TARGET_EXTERNAL__ */

View File

@@ -101,8 +101,8 @@ static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp)
li->width = fbinfo->width;
li->fb = fbinfo->fb_ptr;
li->bpp = fbinfo->depth;
li->rlen = (li->bpp*li->width + 7) / 8;
/*li->rlen = fbinfo->fb_size;*/
li->pitch = (li->bpp*li->width + 7) / 8;
/*li->pitch = fbinfo->fb_size;*/
return 0;
}

View File

@@ -91,7 +91,7 @@ static int a_getinfo (struct lcd_info *li, int width, int height, int bpp)
li->width = modeInfo.width;
li->fb = modeInfo.fbAddress;
li->bpp = modeInfo.colorDepth;
li->rlen = (li->bpp*li->width + 7) / 8;
li->pitch = (li->bpp*li->width + 7) / 8;
return 0;
}

View File

@@ -87,7 +87,7 @@ static int a_getinfo (struct lcd_info *li, int width, int height, int bpp)
//li->bpp = modeInfo.colorDepth;
li->bpp = 32;
printf ("Current color depth is %d \n", modeInfo.colorDepth);
li->rlen = (li->bpp*1024 + 7) / 8;
li->pitch = (li->bpp*1024 + 7) / 8;
return 0;
}