⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ial.c

📁 在ADS环境下MiniGUI的源码
💻 C
字号:
/*
** $Id: ial.c,v 1.81 2004/09/22 07:30:01 jgcheng Exp $
** 
** The Input Abstract Layer of MiniGUI.
**
** Copyright (C) 2003 Feynman Software.
** Copyright (C) 2000, 2002 Wei Yongming.
**
** Current maintainer: Wei Yongming.
**
** Create date: 2000/06/13
*/

/*
** 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
*/

/* 
** TODO:
*/

#include <stdio.h>
#include <string.h>

#include "common.h"

#ifdef _SVGALIB
    #include <vga.h>
    #include <vgamouse.h>
    #include <vgakeyboard.h>
#endif
#ifdef _LIBGGI
    #include <ggi/ggi.h>
#endif

#include "minigui.h"
#include "misc.h"
#include "ial.h"

#ifdef _NATIVE_IAL_ENGINE
#include "native/native.h"
#endif

#ifdef _SVGALIB
    #include "svgalib.h"
#endif
#ifdef _LIBGGI
    #include "libggi.h"
#endif
#ifdef _EP7211_IAL
    #include "ep7211.h"
#endif
#ifdef _ADS_IAL
    #include "ads.h"
#endif
#ifdef _IPAQ_IAL
    #include "ipaq.h"
#endif
#ifdef _VR4181_IAL
    #include "vr4181.h"
#endif
#ifdef _HELIO_IAL
    #include "helio.h"
#endif
#ifdef _TFSTB_IAL
    #include "tf-stb.h"
#endif
#ifdef _T800_IAL
    #include "t800.h"
#endif
#ifdef _DUMMY_IAL
    #include "dummy.h"
#endif
#ifdef _AUTO_IAL
    #include "auto.h"
#endif
#ifdef _HH5249KBDIR_IAL
    #include "hh5249kbdir.h"
#endif
#ifdef _QVFB_IAL
    #include "qvfb.h"
#endif
#ifdef _MPC823_IAL
    #include "mpc823.h"
#endif
#ifdef _UCB1X00_IAL
    #include "ucb1x00.h"
#endif
#ifdef _PX255B_IAL
    #include "px255b.h"
#endif
#ifdef _MC68X328_IAL
    #include "mc68x328.h"
#endif
#ifdef _SMDK2410_IAL
    #include "2410.h"
#endif

#ifdef _EMBEST2410_IAL
    #include "embest2410.h"
#endif

#ifdef _DMGSTB_IAL
    #include "dmg-stb.h"
#endif
#ifdef _FIP_IAL
    #include "fip.h"
#endif
#ifdef _PALMII_IAL
    #include "palm2.h"
#endif
#ifdef _COMM_IAL
    #include "comminput.h"
#endif
#ifdef _HH2410R3_IAL
    #include "hh2410r3.h"
#endif
#ifdef _SVPXX_IAL
    #include "svpxx.h"
#endif
#ifdef _ADS7846_IAL
    #include "ads7846.h"
#endif
#ifdef _L7200_IAL
    #include "l7200.h"
#endif
#ifdef _WVFB_IAL
    #include "wvfb.h"
#endif
#ifdef _UTPMC_IAL
    #include "utpmc.h"
#endif
#ifdef _ARM3000_IAL
    #include "arm3000.h"
#endif
#ifdef _FFT7202_IAL
    #include "fft7202.h"
#endif
#ifdef _DM270_IAL
    #include "dm270.h"
#endif
#ifdef _EVMV10_IAL
    #include "evmv10.h"
#endif
#ifdef _FXRM9200_IAL
    #include "fxrm9200.h"
#endif

#define LEN_ENGINE_NAME        16
#define LEN_MTYPE_NAME         16

static INPUT inputs [] = 
{
#ifdef _DUMMY_IAL
    {"dummy", InitDummyInput, TermDummyInput},
#endif
#ifdef _AUTO_IAL
    {"auto", InitAutoInput, TermAutoInput},
#endif
#ifdef _HH5249KBDIR_IAL
    {"hh5249kbdir", InitHH5249KbdIrInput, TermHH5249KbdIrInput},
#endif
#ifdef _QVFB_IAL
    {"qvfb", InitQVFBInput, TermQVFBInput},
#endif
#ifdef _SVGALIB
    {"SVGALib", InitSVGALibInput, TermSVGALibInput},
#endif
#ifdef _LIBGGI
    {"LibGGI", InitLibGGIInput, TermLibGGIInput},
#endif
#ifdef _EP7211_IAL
    {"EP7211", InitEP7211Input, TermEP7211Input},
#endif
#ifdef _ADS_IAL
    {"ADS", InitADSInput, TermADSInput},
#endif
#ifdef _IPAQ_IAL
    {"ipaq", InitIPAQInput, TermIPAQInput},
#endif
#ifdef _VR4181_IAL
    {"VR4181", InitVR4181Input, TermVR4181Input},
#endif
#ifdef _HELIO_IAL
    {"Helio", InitHelioInput, TermHelioInput},
#endif
#ifdef _NATIVE_IAL_ENGINE
    {"console", InitNativeInput, TermNativeInput},
#endif
#ifdef _TFSTB_IAL
    {"TF-STB", InitTFSTBInput, TermTFSTBInput},
#endif
#ifdef _T800_IAL
    {"T800", InitT800Input, TermT800Input},
#endif
#ifdef _MPC823_IAL
    {"MPC823", InitMPC823Input, TermMPC823Input},
#endif
#ifdef _UCB1X00_IAL
    {"UCB1X00", InitUCB1X00Input, TermUCB1X00Input},
#endif
#ifdef _PX255B_IAL
    {"PX255B", InitPX255BInput, TermPX255BInput},
#endif
#ifdef _MC68X328_IAL
    {"MC68X328", InitMC68X328Input, TermMC68X328Input},
#endif
#ifdef _SMDK2410_IAL
    {"SMDK2410", Init2410Input, Term2410Input},
#endif
#ifdef _DMGSTB_IAL
    {"dmg-stb", InitDMGSTBInput, TermDMGSTBInput},
#endif
#ifdef _FIP_IAL
    {"fip", InitFIPInput, TermFIPInput},
#endif
#ifdef _PALMII_IAL
    {"palm2", InitPALMIIInput, TermPALMIIInput},
#endif
#ifdef _COMM_IAL
    {"comm", InitCOMMInput, TermCOMMInput},
#endif
#ifdef _HH2410R3_IAL
    {"hh2410r3", InitHH2410R3Input, TermHH2410R3Input},
#endif
#ifdef _SVPXX_IAL
    {"svpxx", InitSvpxxInput, TermSvpxxInput},
#endif
#ifdef _ADS7846_IAL
    {"ads7846", InitAds7846Input, TermAds7846Input},
#endif
#ifdef _L7200_IAL
    {"l7200", InitL7200Input, TermL7200Input},
#endif
#ifdef _ARM3000_IAL
    {"arm3000", InitARM3000Input, TermARM3000Input},
#endif
#ifdef _EMBEST2410_IAL
    {"embest2410", InitEMBEST2410Input, TermEMBEST2410Input},
#endif
#ifdef _FFT7202_IAL
    {"fft7202", InitFFTInput, TermFFTInput},
#endif
#ifdef _WVFB_IAL
    {"wvfb", InitWVFBInput, TermWVFBInput}, 
#endif
#ifdef _UTPMC_IAL
    {"utpmc", InitUTPMCInput, TermUTPMCInput},
#endif
#ifdef _DM270_IAL
    {"dm270", InitDM270Input, TermDM270Input},
#endif
#ifdef _EVMV10_IAL
    {"evmv10", InitXscaleEVMV10Input, TermXscaleEVMV10Input},
#endif
#ifdef _FXRM9200_IAL
    {"fxrm9200", InitRm9200Input, TermRm9200Input},
#endif
};

INPUT* cur_input;

#define NR_INPUTS  (sizeof (inputs) / sizeof (INPUT))

int InitIAL (void)
{
    int  i;

    char buff [LEN_ENGINE_NAME + 1];
    char mdev [MAX_PATH + 1];
    char mtype[LEN_MTYPE_NAME + 1];

    if (NR_INPUTS == 0)
        return ERR_NO_ENGINE;

    if (GetMgEtcValue ("system", "ial_engine", buff, LEN_ENGINE_NAME) < 0)
        return ERR_CONFIG_FILE;

    if (GetMgEtcValue ("system", "mdev", mdev, MAX_PATH) < 0)
        return ERR_CONFIG_FILE;

    if (GetMgEtcValue ("system", "mtype", mtype, LEN_MTYPE_NAME) < 0)
        return ERR_CONFIG_FILE;


    for (i = 0; i < NR_INPUTS; i++) {
        if (strncmp (buff, inputs[i].id, LEN_ENGINE_NAME) == 0) {
            cur_input = inputs + i;
            break;
        }
    }
   
    if (cur_input == NULL) {
        fprintf (stderr, "IAL: Does not find matched engine.\n");
        if (NR_INPUTS) {
            cur_input = inputs;
            fprintf (stderr, "IAL: Use the first engine: %s\n", cur_input->id);
        }
        else
            return ERR_NO_MATCH;
    }

    strcpy (cur_input->mdev, mdev);

    if (!IAL_InitInput (cur_input, mdev, mtype)) {
        fprintf (stderr, "IAL: Init IAL engine failure.\n");
        return ERR_INPUT_ENGINE;
    }

#ifdef _DEBUG
    fprintf (stderr, "IAL: Use %s engine.\n", cur_input->id);
#endif

    return 0;
}

void TerminateIAL (void)
{
    IAL_TermInput ();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -