-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
113 lines (99 loc) · 2.44 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Copyright (c) 2015 Kenji Aoyama.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* NEC Windows Accelerator Board test on OpenBSD/luna88k
*/
#include <stdio.h>
#include <stdlib.h> /* getprogname(3) */
#include <unistd.h> /* getopt(3) */
#include <sys/ioctl.h>
#include "necwab.h"
#include "nec_cirrus.h"
#include "nec_s3.h"
void usage(void);
/* global */
int debug;
int
main(int argc, char **argv)
{
int mode;
struct board_type_t bt;
const char *errstr;
/*
* parse options
*/
int ch;
extern char *optarg;
extern int optind, opterr;
while ((ch = getopt(argc, argv, "dr:")) != -1) {
switch (ch) {
case 'd': /* debug flag */
debug = 1;
break;
default:
usage();
return 1;
/* NOTREACHED */
}
}
argc -= optind;
argv += optind;
if (argc == 0)
mode = 2;
else if (argc == 1)
mode = (int)strtonum(argv[0], 0, 63, &errstr);
switch (mode) {
case 0x0: /* 640x480, 8bpp */
case 0x1: /* 800x600, 8bpp */
case 0x2: /* 1024x768, 8bpp (default) */
case 0x3: /* 1280x1024, 8bpp */
case 0x10: /* 640x480, 16bpp(5-6-5) */
case 0x11: /* 800x600, 16bpp(5-6-5) */
case 0x12: /* 1024x768, 16bpp(5-6-5) */
break;
default:
usage();
return 1;
}
necwab_init(&bt);
switch (bt.type) {
case 0x20:
case 0x21:
nec_s3_main(2);
break;
case 0x60: /* NEC WAB-B3 */
if ((mode == 0x3) || (mode == 0x12)) {
printf("can not use mode 0x%x on NEC WAB-B3\n", mode);
break;
}
/* FALLTHROUGH */
case 0xc2: /* MELCO WGN/WSN-A */
nec_cirrus_main(&bt, mode);
break;
default:
break;
}
necwab_fini();
return 0;
}
void
usage(void)
{
extern char *__progname;
printf("Usage: %s [mode]\n", __progname);
printf("\tmode:\t 0: 640x480x8bpp, 1: 800x600x8bpp, 2: 1024x768x8bpp(default)\n");
printf("\t\t16: 640x480x16bpp, 17: 800x600x16bpp\n");
}