/
Program.cs
72 lines (63 loc) · 2.68 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using OpenLibSys;
namespace SetFSB {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var ols = InitIO();
if(ols == null) return;
var smb = new smBus(ols);
//smb.enable_smbus();
var plls = new List<Pll>(){new ICS9LPRS365BGLF(smb), new ICS9LPRS355(smb)};
Application.Run(new Form1(plls));
}
public static Ols InitIO(){
var ols = new Ols();
// Check support library sutatus
switch (ols.GetStatus()){
case (uint) Ols.Status.NO_ERROR:
break;
case (uint) Ols.Status.DLL_NOT_FOUND:
MessageBox.Show("Status Error!! DLL_NOT_FOUND");
return null;
case (uint) Ols.Status.DLL_INCORRECT_VERSION:
MessageBox.Show("Status Error!! DLL_INCORRECT_VERSION");
return null;
case (uint) Ols.Status.DLL_INITIALIZE_ERROR:
MessageBox.Show("Status Error!! DLL_INITIALIZE_ERROR");
return null;
}
// Check WinRing0 status
switch (ols.GetDllStatus()){
case (uint) Ols.OlsDllStatus.OLS_DLL_NO_ERROR:
break;
case (uint) Ols.OlsDllStatus.OLS_DLL_DRIVER_NOT_LOADED:
MessageBox.Show("DLL Status Error!! OLS_DRIVER_NOT_LOADED");
return null;
case (uint) Ols.OlsDllStatus.OLS_DLL_UNSUPPORTED_PLATFORM:
MessageBox.Show("DLL Status Error!! OLS_UNSUPPORTED_PLATFORM");
return null;
case (uint) Ols.OlsDllStatus.OLS_DLL_DRIVER_NOT_FOUND:
MessageBox.Show("DLL Status Error!! OLS_DLL_DRIVER_NOT_FOUND");
return null;
case (uint) Ols.OlsDllStatus.OLS_DLL_DRIVER_UNLOADED:
MessageBox.Show("DLL Status Error!! OLS_DLL_DRIVER_UNLOADED");
return null;
case (uint) Ols.OlsDllStatus.OLS_DLL_DRIVER_NOT_LOADED_ON_NETWORK:
MessageBox.Show("DLL Status Error!! DRIVER_NOT_LOADED_ON_NETWORK");
return null;
case (uint) Ols.OlsDllStatus.OLS_DLL_UNKNOWN_ERROR:
MessageBox.Show("DLL Status Error!! OLS_DLL_UNKNOWN_ERROR");
return null;
}
return ols;
}
}
}