source: sbliveos2/trunk/lib32/ossidc.cpp@ 148

Last change on this file since 148 was 148, checked in by sandervl, 25 years ago

beta 0.25 update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: ossidc.cpp 148 2000-04-26 18:01:02Z sandervl $ */
2
3//******************************************************************************
4// OS/2 IDC services (callback to 16 bits MMPM2 driver)
5//
6// Copyright 2000 Sander van Leeuwen (sandervl@xs4all.nl)
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License as
10// published by the Free Software Foundation; either version 2 of
11// the License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public
19// License along with this program; if not, write to the Free
20// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
21// USA.
22//
23//******************************************************************************
24#define INCL_NOPMAPI
25#define INCL_DOSERRORS // for ERROR_INVALID_FUNCTION
26#include <os2.h>
27#include <ossdefos2.h>
28#include <ossidc.h>
29#include <devhelp.h>
30#ifdef KEE
31#include <kee.h>
32#endif
33
34//******************************************************************************
35//******************************************************************************
36BOOL CallOSS16(ULONG cmd, ULONG param1, ULONG param2)
37{
38 IDC16_PACKET idcpacket;
39 ULONG pPacket;
40 BOOL rc;
41
42 if(idc16_PddHandler == 0) {
43 return FALSE;
44 }
45 idcpacket.param1 = param1;
46 idcpacket.param2 = param2;
47#ifdef KEE
48 pPacket = (ULONG)__FlatToStack(&idcpacket);
49#else
50 pPacket = (ULONG)__Compress48Pointer((char FAR48 *)&idcpacket);
51#endif
52
53#ifdef KEE
54 //NOTE: This isn't safe if the compiler uses ebp (or esp) to hold
55 // idc16_PddHandler, cmd or pPacket!! (works now though)
56 KernThunkStackTo16();
57//// KernSerialize16BitDD();
58#endif
59 rc = idc16_PddHandler(cmd, pPacket);
60#ifdef KEE
61//// KernUnserialize16BitDD();
62 KernThunkStackTo32();
63#endif
64
65 return rc;
66}
67//******************************************************************************
68//******************************************************************************
69BOOL OSS32_SetIrq(int irq, ULONG handler)
70{
71 return CallOSS16(IDC16_SETIRQ, irq, handler);
72}
73//******************************************************************************
74//******************************************************************************
75BOOL OSS32_FreeIrq(int irq)
76{
77 return CallOSS16(IDC16_FREEIRQ, irq, 0);
78}
79//******************************************************************************
80extern "C" int init_module();
81extern "C" void cleanup_module();
82//******************************************************************************
83BOOL OSS32_InitDriver()
84{
85 return init_module() == 0;
86}
87//******************************************************************************
88//Called during OS/2 shutdown
89//******************************************************************************
90void OSS32_RemoveDriver()
91{
92 cleanup_module();
93}
94//******************************************************************************
95//******************************************************************************
96extern "C" int OSS32_ProcessIRQ(int fWaveOut, unsigned long streamid)
97{
98 return CallOSS16(IDC16_PROCESS, fWaveOut, streamid);
99}
100//******************************************************************************
101//******************************************************************************
Note: See TracBrowser for help on using the repository browser.