1 | /* $Id: idc_vdd.c 142 2000-04-23 14:55:46Z ktk $ */
|
---|
2 |
|
---|
3 | #define INCL_16
|
---|
4 | #define INCL_DOSINFOSEG
|
---|
5 | #include <os2.h>
|
---|
6 |
|
---|
7 | #include "idc_vdd.h"
|
---|
8 | #include <include.h>
|
---|
9 | #include <devhelp.h>
|
---|
10 |
|
---|
11 | ULONG pLincodec = 0;
|
---|
12 |
|
---|
13 | ADAPTERINFO __far * pfcodec_info;
|
---|
14 | ADAPTERINFO codec_info;
|
---|
15 | USHORT usInUseCount = 0;
|
---|
16 | USHORT usVDDHasHardware = FALSE;
|
---|
17 |
|
---|
18 | #pragma off (unreferenced);
|
---|
19 |
|
---|
20 |
|
---|
21 | // -------------------------- IDCVddOPENPDD -
|
---|
22 | // OS/2 MVDM kernel calls us to provide the IDC address
|
---|
23 | // of the Virtual Device driver.
|
---|
24 | // The VDD can also call (with address of NULL) to terminate
|
---|
25 | // future IDC between the drivers.
|
---|
26 | //
|
---|
27 | ULONG IDCVddOPENPDD (ULONG ul1, ULONG ul2)
|
---|
28 | {
|
---|
29 | // Nothing to do, we don't call the VDD
|
---|
30 | // ###should save the vdd entry point so we can call him later...
|
---|
31 | // we should inform him of shutdowns, apm events and when the hardware
|
---|
32 | // becomes free......
|
---|
33 | return (TRUE);
|
---|
34 | }
|
---|
35 | // -------------------- IDCVddQUERYPROTOCOL -
|
---|
36 | ULONG IDCVddQUERYPROTOCOL (ULONG ul1, ULONG ul2)
|
---|
37 | {
|
---|
38 | // if the VDD sends us Dead Beef
|
---|
39 | // We Return Dead Beef just like Hudson Foods !!
|
---|
40 | if (ul1 == IDC_PROTOCOL_LEVEL) {
|
---|
41 | return (IDC_PROTOCOL_LEVEL);
|
---|
42 | }
|
---|
43 | // Else Return junk
|
---|
44 | else {
|
---|
45 | return (-1);
|
---|
46 | } /* endif */
|
---|
47 | }
|
---|
48 |
|
---|
49 | // ---------------------- IDCVddASSIGNHANDLE -
|
---|
50 | ULONG IDCVddASSIGNHANDLE (ULONG ul1, ULONG ul2)
|
---|
51 | {
|
---|
52 | return (FALSE);
|
---|
53 | }
|
---|
54 | // ---------------------- IDCVddOPENDEVICE -
|
---|
55 | ULONG IDCVddOPENDEVICE (ULONG ul1, ULONG ul2)
|
---|
56 | {
|
---|
57 | if (usInUseCount == 0) {
|
---|
58 | usVDDHasHardware = TRUE;
|
---|
59 | return (TRUE);
|
---|
60 | }
|
---|
61 | else {
|
---|
62 | return (FALSE);
|
---|
63 | } /* endif */
|
---|
64 | }
|
---|
65 | // -------------------- IDCVddCLOSEDEVICE -
|
---|
66 | ULONG IDCVddCLOSEDEVICE (ULONG ul1, ULONG ul2)
|
---|
67 | {
|
---|
68 | usVDDHasHardware = FALSE;
|
---|
69 | return (TRUE);
|
---|
70 | }
|
---|
71 | // ------------------ IDCVddGETIOPORTINFO -
|
---|
72 | ULONG IDCVddGETIOPORTINFO (ULONG ul1, ULONG ul2)
|
---|
73 | {
|
---|
74 | return (pLincodec);
|
---|
75 | }
|
---|
76 | // --------------------- IDCVddTRUSTEDOPEN -
|
---|
77 | ULONG IDCVddTRUSTEDOPEN (ULONG ul1, ULONG ul2)
|
---|
78 | {
|
---|
79 | return (FALSE);
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | ULONG (*IDCVddFuncs[]) (ULONG ul1, ULONG ul2) =
|
---|
84 | {
|
---|
85 | IDCVddOPENPDD,
|
---|
86 | IDCVddQUERYPROTOCOL,
|
---|
87 | IDCVddASSIGNHANDLE,
|
---|
88 | IDCVddOPENDEVICE,
|
---|
89 | IDCVddCLOSEDEVICE,
|
---|
90 | IDCVddGETIOPORTINFO,
|
---|
91 | IDCVddTRUSTEDOPEN
|
---|
92 | };
|
---|
93 | USHORT MaxIDCVddFuncs = sizeof(IDCVddFuncs)/sizeof(USHORT);
|
---|
94 |
|
---|
95 |
|
---|
96 | // ---------------------- IDCEntry_VDD_c -
|
---|
97 | // Interface for other VDDs to call this device driver
|
---|
98 | //
|
---|
99 | ULONG pascal IDCEntry_VDD_c (ULONG ulFunc, ULONG ul1, ULONG ul2)
|
---|
100 | {
|
---|
101 | if (ulFunc > MaxIDCVddFuncs) {
|
---|
102 | return (FALSE);
|
---|
103 | }
|
---|
104 | else {
|
---|
105 | return (IDCVddFuncs [ulFunc](ul1,ul2));
|
---|
106 | }
|
---|
107 | }
|
---|