-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAIN.C
70 lines (51 loc) · 1.58 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
/*
* ISAWAIT
*
* (C) 2022-2023 Eric Voirin (oerg866@googlemail.com)
*
* Tool to set 8 and 16-bit I/O Recovery Time Clock Cycles
* on supported chipsets
*
* Refer to README.MD
*/
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include "TYPES.H"
#include "PCI.H"
#include "ISAWAIT.H"
#define VERSION "1.0"
int main(int argc, char *argv[]) {
int iorec8_new = 0;
int iorec16_new = 0;
printf("ISAWAIT Version %s\n", VERSION);
printf(" (C)2022-2023 Eric Voirin (oerg866@googlemail.com)\n");
printf(" Contact via Discord: oerg866 \n");
printf("----------------------------------------\n");
if (argc < 3) {
printf("ISAWAIT Sets the ISA I/O recovery / wait state timer.\n");
printf("It can be useful to debug malfunctioning ISA devices\n");
printf("(e.g. OPL2/3 synthesizer chip).\n");
printf("Usage: ISAWAIT <8 bit cycles> <16 bit cycles>\n");
printf("Cycle values can be 1 to 8 for 8-bit, 1 to 4 for 16-bit.\n");
printf("Set to 0 to disable wait states for that bus width.\n");
printf("Set to -1 to leave value unchagned\n");
return -1;
}
printf("\n\n");
iorec8_new = atoi(argv[1]);
iorec16_new = atoi(argv[2]);
if (iorec8_new > 8) {
printf("Invalid value for 8-Bit I/O recovery.\n");
return -1;
}
if (iorec16_new > 4) {
printf("Invalid value for 16-Bit I/O recovery.\n");
return -1;
}
if (!pci_test()) {
printf("ERROR enumerating PCI bus. Quitting...\n");
return -1;
}
return isawait_set(iorec8_new, iorec16_new);
}