?? mgdrv-ucosii.c
字號:
/** * \file mgdrv-ucosii.h * \author Zhong Shuyi <zhongsy@minigui.org> * \date 2002/01/06 * \verbatim Copyright (C) 2002-2005 Feynman Software. Copyright (C) 1998-2002 Wei Yongming. This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA If you are using MiniGUI for developing commercial, proprietary, or other software not covered by the GPL terms, you must have a commercial license for MiniGUI. Please see http://www.minigui.com/product/index.html for how to obtain this. If you are interested in the commercial MiniGUI licensing, please write to sales@minigui.com. \endverbatim *//* * $Id: mgdrv-ucosii.c,v 1.2 2005/01/31 09:49:30 weiym Exp $ * * MiniGUI for Linux/uClinux, eCos, uC/OS-II, and VxWorks version 1.6.x * Copyright (C) 2002-2005 Feynman Software. * Copyright (C) 1998-2002 Wei Yongming. */#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>/* --------------------- For Common IAL Engine ----------------- *//* Should be implemented if you use common ial engine in MiniGUI */#define COMM_MOUSEINPUT 0x01 // mouse event#define COMM_KBINPUT 0x02 // keyboard event/* * Waits for input for keyboard and touchpanel. * If no data, this function should go into sleep; * when data is available, keyboard or touchpanel driver should wake up * the task/thread in MiniGUI who call comm_wait_for_input. * * Normal implementation make this function sleep on a ucosii semaphore. * return COMM_MOUSEINPUT or COMM_KBINPUT according to type of the input event. */int comm_wait_for_input (void){ // TODO... return 0;}/* * Gets touchpanel position and button data. * x, y : position values * button : Non-zero value means pen is down. */int comm_ts_getdata (short *x, short *y, short *button){ // TODO... return 0;}/* * Gets keyboard key data. * key : return MiniGUI scancode of the key. * key_status : key down or up, non-zero value means down. */int comm_kb_getdata (short *key, short *key_status){ // TODO... return 0;}/* --------------------- I/O functions -------------------------- */// for debug purpose/* Gets a char from uart */BYTE drv_uart_get_byte (void){ // TODO...}/* Sends a char to uart */void drv_uart_send_byte (BYTE ch){ // TODO...}/* ----------------- Implementation of MiniGUI LCD driver interface --------------- */#define FB_TYPE_RGB565 1 // RGB565 color format for 16 bpp#define FB_TYPE_RGB332 2 // RGB332 color format for 8 bppstruct lcd_info { short height, width; // Pixels short bpp; // Depth (bits/pixel) short type; // pixel type short rlen; // Length of one raster line in bytes void *fb; // Frame buffer};int drv_lcd_init (void){ /* Do LCD initialization here, if you have not. */ return 0;}int drv_lcd_getinfo (struct lcd_info *li){ /* * Set LCD information in a lcd_info structure pointed by li * according to properties of your LCD. */ li->width = 320; li->height = 240; li->bpp = 16; li->type = FB_TYPE_RGB565; li->rlen = 320; li->fb = (void*)0xc000000; return 0;}/* ------------------- Application entry for uC/OS-II -------------- *//* for reference only *//* * main task of MiniGUI */static void* mg_main_task (void* args){ OSTimeDly (400); /* * Enter entry in MiniGUI library */ minigui_entry (0, NULL); return NULL;}/* * MiniGUI entry for uC/OS-II * You can call this function before you call OSStart. */void minigui_app_entry (void){ pthread_t main_thread; /* * Should initialize heap memory management module first * before using MiniGUI. */ if (ucos2_malloc_init ()) { fprintf (stderr, "Can not init our own malloc implementation for uC/OS-II.\n"); return; } /* * Should initialize POSIX thread module first * before using MiniGUI. */ if (ucos2_posix_pthread_init ()) { fprintf (stderr, "Can not init our own pthread implementation for uC/OS-II.\n"); return; } /* * Creating a independent thread for MiniGUI main task is a good idea. */ pthread_create (&main_thread, NULL, mg_main_task, NULL);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -