Import upstream u-boot 1.1.4
[u-boot.git] / board / MAI / bios_emulator / scitech / src / pm / tests / vftest.c
1 /****************************************************************************
2 *
3 *                   SciTech OS Portability Manager Library
4 *
5 *  ========================================================================
6 *
7 *    The contents of this file are subject to the SciTech MGL Public
8 *    License Version 1.0 (the "License"); you may not use this file
9 *    except in compliance with the License. You may obtain a copy of
10 *    the License at http://www.scitechsoft.com/mgl-license.txt
11 *
12 *    Software distributed under the License is distributed on an
13 *    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 *    implied. See the License for the specific language governing
15 *    rights and limitations under the License.
16 *
17 *    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
18 *
19 *    The Initial Developer of the Original Code is SciTech Software, Inc.
20 *    All Rights Reserved.
21 *
22 *  ========================================================================
23 *
24 * Filename:     $Workfile$
25 * Version:      $Revision: 1.1 $
26 *
27 * Language:     ANSI C
28 * Environment:  any
29 *
30 * Description:  Test program to test the VFlat virtual framebuffer functions.
31 *
32 *               Functions tested:   VF_available()
33 *                                   VF_init()
34 *                                   VF_exit()
35 *
36 * $Date: 2002/10/02 15:35:21 $ $Author: hfrieden $
37 *
38 ****************************************************************************/
39
40 #include <stdlib.h>
41 #include <stdio.h>
42 #include "pmapi.h"
43
44 uchar code[] = {
45     0xC3,                   /* ret          */
46     };
47
48 int main(void)
49 {
50     void    *vfBuffer;
51
52     printf("Program running in ");
53     switch (PM_getModeType()) {
54         case PM_realMode:
55             printf("real mode.\n\n");
56             break;
57         case PM_286:
58             printf("16 bit protected mode.\n\n");
59             break;
60         case PM_386:
61             printf("32 bit protected mode.\n\n");
62             break;
63         }
64
65     if (!VF_available()) {
66         printf("Virtual Linear Framebuffer not available.\n");
67         exit(1);
68         }
69
70     vfBuffer = VF_init(0xA0000,64,sizeof(code),code);
71     if (!vfBuffer) {
72         printf("Failure to initialise Virtual Linear Framebuffer!\n");
73         exit(1);
74         }
75     VF_exit();
76     printf("Virtual Linear Framebuffer set up successfully!\n");
77     return 0;
78 }