mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-08-18 12:27:22 +08:00
CommLCD engine
+108
-6
@@ -1,6 +1,7 @@
|
||||
# Using CommLCD NEWGAL Engine and Comm IAL Engine
|
||||
|
||||
_How to define external stubs to implement your CommLCD engine and Comm IAL engine outside MiniGUI Core._
|
||||
_How to define external stubs to implement your CommLCD engine and
|
||||
Comm IAL engine outside MiniGUI Core._
|
||||
|
||||
## Introduction
|
||||
|
||||
@@ -17,11 +18,112 @@ two engines.
|
||||
## Key Points
|
||||
|
||||
* Use MiniGUI 3.2.2 or later.
|
||||
* Enable the engines when configuring MiniGUI: `--enable-videocommlcd` and `--enable-commial`).
|
||||
* Implement the external stubs in your app side (`#include <minigui/exstubs.h>`).
|
||||
* Specify `gal_engine=commlcd` and `ial_engine=comm` in your runtime configuration.
|
||||
* Enable the engines when configuring MiniGUI:
|
||||
* `--enable-videocommlcd`: enable CommLCD NEWGAL engine.
|
||||
* `--enable-commial`: enable Comm IAL engine.
|
||||
* `--with-targetname=external`: define target name to be `external`.
|
||||
* Implement the external stubs in your app side:
|
||||
* `#include <minigui/exstubs.h>`
|
||||
* Specify the following runtime configuration options:
|
||||
* `gal_engine=commlcd`: use CommLCD NEWGAL engine.
|
||||
* `ial_engine=comm`: use comm IAL engine.
|
||||
* Sample code: [`commlcd` in `mg-samples`](https://github.com/VincentWei/mg-samples/tree/master/commlcd)
|
||||
|
||||
##
|
||||
## Functions to be Implemented
|
||||
|
||||
TBC
|
||||
In MiniGUI header file `<minigui/exstubs.h>`, we declare the function
|
||||
prototypes you need to implement for these two engines. You must
|
||||
include this header in your C source file(s), and implement all
|
||||
of the functions correctly.
|
||||
|
||||
In the `commlcd` sample of `mg-samples` package, the file `commlcd_ops.c`
|
||||
implements the functions for CommLCD NEWGAL engine, and the file `comminput_ops.c`
|
||||
implements the functions for Comm IAL engine:
|
||||
|
||||
* [`commlcd_ops.c`](https://github.com/VincentWei/mg-samples/blob/master/commlcd/commlcd_ops.c)
|
||||
* [`comminput_ops.c`](https://github.com/VincentWei/mg-samples/blob/master/commlcd/comminput_ops.c)
|
||||
|
||||
The former implementation does not connect to any real device; it creates
|
||||
an anonymous memory map and returns the address of the memory map as
|
||||
the frame buffer to MiniGUI. However, when there is a update, this engine
|
||||
will save the whole frame buffer content to a Windows bitmap file. So you
|
||||
can observe the behaviors of the engine.
|
||||
|
||||
The latter implementation gives you a sample which gets input events
|
||||
from a touch screen on Linux, and passed the events to MiniGUI. If you
|
||||
have no such device, the engine will fails to initialize.
|
||||
|
||||
### CommLCD NEWGAL engine
|
||||
|
||||
#### Initializing the engine
|
||||
|
||||
`__commlcd_drv_init` will be called when initializing your
|
||||
CommLCD engine implementation. In the `commlcd` sample, it does nothing
|
||||
and just returns zero:
|
||||
|
||||
int __commlcd_drv_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Note that, all external methods for CommLCD engine should return zero for success.
|
||||
|
||||
#### Setting video mode
|
||||
|
||||
`__commlcd_drv_getinfo` will be called when MiniGUI trying to set the video
|
||||
mode according to your settings in the MiniGUI runtime configuration, e.g.,
|
||||
`defaultmode=240x320-32bpp`.
|
||||
|
||||
In our sample, it creates the anonymous memory map by calling `mmap` system
|
||||
call and returns the video information via `struct commlcd_info* li`:
|
||||
|
||||
int __commlcd_drv_getinfo (struct commlcd_info *li, int width, int height, int depth)
|
||||
{
|
||||
sg_fb = (BYTE*) mmap (0, FB_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
if (sg_fb == MAP_FAILED) {
|
||||
perror ("Failed calling __commlcd_drv_getinfo: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
li->type = COMMLCD_TRUE_ARGB8888;
|
||||
li->height = SCREEN_HEIGHT;
|
||||
li->width = SCREEN_WIDTH;
|
||||
li->bpp = COLOR_DEPTH;
|
||||
li->pitch = SCREEN_WIDTH * BYTES_PER_PIXEL;
|
||||
li->update_method = COMMLCD_UPDATE_ASYNC;
|
||||
li->fb = sg_fb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
You need fill the all fields of `struct commlcd_info* li` by the correct
|
||||
values:
|
||||
|
||||
* `type`: The video mode type. Currently, CommLCD supports the following modes:
|
||||
- `COMMLCD_PSEUDO_RGB332`: 256-color video mode.
|
||||
- `COMMLCD_TRUE_RGB555`: RGB555 15-bit video mode.
|
||||
- `COMMLCD_TRUE_RGB565`: RGB565 16-bit video mode.
|
||||
- `COMMLCD_TRUE_RGB888`: RGB888 24-bit video mode.
|
||||
- `COMMLCD_TRUE_RGB0888`: RGB0888 32-bit video mode (without alpha component).
|
||||
- `COMMLCD_TRUE_ARGB1555`: RGB1555 16-bit video mode (the alpha component use 1 bit only).
|
||||
- `COMMLCD_TRUE_ARGB8888`: RGB8888 32-bit video mode (the alpha, red, green, blue components all use 8 bits).
|
||||
* `height`: The vertical resolution in pixels.
|
||||
* `width`: The horizontal resolution in pixels.
|
||||
* `bpp`: The color depth in bits per pixels. Actually, this field is a redundancy,
|
||||
because the type already contains the depth information.
|
||||
* `pitch`: The length in bytes of one scan line. Generally, it should be a
|
||||
times of 4, i.e., the address of each scan line should be 4-byte aligned.
|
||||
* `update_method`: The update method when there is a dirty rectangle, can be
|
||||
one of the following values:
|
||||
- `COMMLCD_UPDATE_NONE`: do not call `__commlcd_drv_update` (see below).
|
||||
- `COMMLCD_UPDATE_SYNC`: call `__commlcd_drv_update` synchronously.
|
||||
- `COMMLCD_UPDATE_ASYNC`: call `__commlcd_drv_update` asynchronously.
|
||||
* `fb`: The address of the frame buffer.
|
||||
|
||||
### Comm IAL engine
|
||||
|
||||
## Summary
|
||||
|
||||
## References
|
||||
|
||||
* [GAL and IAL Engines](http://wiki.minigui.com/twiki/bin/view/Products/MiniGUIPGV32Part5Chapter03)
|
||||
|
||||
+2
-2
@@ -32,8 +32,6 @@ We call these documents "MiniGUI Supplementary Documents".
|
||||
|
||||
## Supplementary Documents
|
||||
|
||||
* [Using SyncUpdateDC to Reduce Screen Flicker](https://github.com/VincentWei/minigui/wiki/Sync-Update) -
|
||||
How to use MiniGUI's synchronous update mechanism to reduce screen flicker.
|
||||
* [Using CommLCD NEWGAL Engine and Comm IAL Engine](https://github.com/VincentWei/minigui/wiki/Comm-Engines) -
|
||||
How to define external stubs to implement your CommLCD engine and Comm
|
||||
IAL engine outside MiniGUI Core.
|
||||
@@ -42,6 +40,8 @@ We call these documents "MiniGUI Supplementary Documents".
|
||||
your MiniGUI apps.
|
||||
* [Using Enhanced LOGFONT and DEVFONT Interfaces](https://github.com/VincentWei/minigui/wiki/Enhanced-Font) -
|
||||
Understand and use enhanced LOGFONT and DEVFONT intefaces of MiniGUI 4.0.
|
||||
* [Using SyncUpdateDC to Reduce Screen Flicker](https://github.com/VincentWei/minigui/wiki/Sync-Update) -
|
||||
How to use MiniGUI's synchronous update mechanism to reduce screen flicker.
|
||||
* [Laying out, Shaping, and Rendering Text in Complex/Mixed Scripts](https://github.com/VincentWei/minigui/wiki/Complex-Scripts) -
|
||||
How to lay out, shape, and render text in complex or mixed scripts on MiniGUI 4.0.
|
||||
* [Writing MiniGUI Apps for 64-bit Platforms](https://github.com/VincentWei/minigui/wiki/64-bit-Platform) -
|
||||
|
||||
Reference in New Issue
Block a user