[home] :: Porting MINIGUI to MINI2440
0 products in your
Porting MINIGUI to MINI2440
MiniGUI is a free software project. It aims to provide a fast, stable, and cross-operating-system graphics user interface (GUI) support system. In this article we are going to talk about porting MINIGUI to the MINI2440 development board.
According to http://www.minigui.org, MiniGUI is a free software project. It aims to provide a fast, stable, and cross-operating-system graphics user interface (GUI) support system, which is especially fit for real-time embedded systems based-on Linux/uClinux, eCos, and other traditional RTOSes, such as VxWorks, ThreadX, uC/OS-II, and Nucleus.
An introduction to MINIGUI can be found at http://www.linuxdevices.com/articles/AT5520972121.html
In this article we are going to talk about porting MINIGUI to the MINI2440 development board.
Porting MINIGUI generally means to port the GAL (Graphics Abstraction Layer) and IAL (Input Abstraction Layer). The concept of an abstraction layer is somewhat similar to the concept of a driver in an operating system. An abstraction layer defines a set of abstract interfaces independent of any particular hardware or low-level systems, and all the top-level graphics operations and input process are based on these interfaces.
A driver for Framebuffer device has already been included in the MINI2440 development board, so the GAL can directly use the ‟fbcon‟. The input devices on the MINI2440 include one touch screen and 6 user buttons, so the main job of porting MINIGUI is to write a IAL driver.
Download the source code tarball of MINIGUI: libminigui-str-1.6.2.tar.gz at http://www.minigui.org/res.shtml
We take the MSDK2410() as the basement of modification. Modify ‟\libminigui-str-1.6.2\src\ial\2410.c‟ and ‟\libminigui-str-1.6.2\src\ial\2410.h‟.
Touch Screen:
The IAL of MSDK2410 might reverse the direction of the Y-axis of the touch screen. Modify it in the following functions:
In the function wait_event() in the file 2410.c, modify the following:
if (ts_event.pressure > 0)
{
mousex = ts_event.x;
mousey = ts_event.y;
}
to
if (ts_event.pressure > 0)
{
mousex = ts_event.x;
mousey = 319 - ts_event.y;
}
Buttons:
After reading the source code of the MINI2440 button driver(CD\linux\linux-2.6.13-mini2440-20080910\kernel-2.6.13\drivers\micro2440_buttons.c), we know that the status of the buttons are presented by a group of numbers:
static volatile int key_values [] = {0, 0, 0, 0, 0, 0};
The six numbers respectively present the six key (k1~k6), when the keys are unpressed, the value of the keys are all 0, when pressed, the values of the key are respectively 1,2,3,4,5,6, when released, the values become the corresponding value plus 0x80.
Map the six keys as the following:
K1: Enter
K2: B
K3: Tab
K4: BackSpace
K5: A
K6: Esc
Add the three macros into 2410.h:
#define KBD_DEVICE "/dev/buttons"
#define NR_KEYS 128
#define KEY_RELEASED 0x80
and the following global variables into 2410.c
static unsigned char state [NR_KEYS];
static int get_state[6];
static int get_flag[6];
static int ts = -1;
static int btn_fd = -1;
Then add two functions:
keyboard_update(void)
keyboard_getstate(void)
Modify the following functions:
Init2410Input(), wait_event() and Term2410Input()
The modified file 2410.h and 2410.c can be downloaded at http://www.developmentboard.net/ressources/example-code/MINI2440/minigui.rar
An introduction to MINIGUI can be found at http://www.linuxdevices.com/articles/AT5520972121.html
In this article we are going to talk about porting MINIGUI to the MINI2440 development board.
Porting MINIGUI generally means to port the GAL (Graphics Abstraction Layer) and IAL (Input Abstraction Layer). The concept of an abstraction layer is somewhat similar to the concept of a driver in an operating system. An abstraction layer defines a set of abstract interfaces independent of any particular hardware or low-level systems, and all the top-level graphics operations and input process are based on these interfaces.
A driver for Framebuffer device has already been included in the MINI2440 development board, so the GAL can directly use the ‟fbcon‟. The input devices on the MINI2440 include one touch screen and 6 user buttons, so the main job of porting MINIGUI is to write a IAL driver.
Download the source code tarball of MINIGUI: libminigui-str-1.6.2.tar.gz at http://www.minigui.org/res.shtml
We take the MSDK2410() as the basement of modification. Modify ‟\libminigui-str-1.6.2\src\ial\2410.c‟ and ‟\libminigui-str-1.6.2\src\ial\2410.h‟.
Touch Screen:
The IAL of MSDK2410 might reverse the direction of the Y-axis of the touch screen. Modify it in the following functions:
In the function wait_event() in the file 2410.c, modify the following:
if (ts_event.pressure > 0)
{
mousex = ts_event.x;
mousey = ts_event.y;
}
to
if (ts_event.pressure > 0)
{
mousex = ts_event.x;
mousey = 319 - ts_event.y;
}
Buttons:
After reading the source code of the MINI2440 button driver(CD\linux\linux-2.6.13-mini2440-20080910\kernel-2.6.13\drivers\micro2440_buttons.c), we know that the status of the buttons are presented by a group of numbers:
static volatile int key_values [] = {0, 0, 0, 0, 0, 0};
The six numbers respectively present the six key (k1~k6), when the keys are unpressed, the value of the keys are all 0, when pressed, the values of the key are respectively 1,2,3,4,5,6, when released, the values become the corresponding value plus 0x80.
Map the six keys as the following:
K1: Enter
K2: B
K3: Tab
K4: BackSpace
K5: A
K6: Esc
Add the three macros into 2410.h:
#define KBD_DEVICE "/dev/buttons"
#define NR_KEYS 128
#define KEY_RELEASED 0x80
and the following global variables into 2410.c
static unsigned char state [NR_KEYS];
static int get_state[6];
static int get_flag[6];
static int ts = -1;
static int btn_fd = -1;
Then add two functions:
keyboard_update(void)
keyboard_getstate(void)
Modify the following functions:
Init2410Input(), wait_event() and Term2410Input()
The modified file 2410.h and 2410.c can be downloaded at http://www.developmentboard.net/ressources/example-code/MINI2440/minigui.rar