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

Last change on this file since 142 was 142, checked in by ktk, 25 years ago

Import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: ossidc.cpp 142 2000-04-23 14:55:46Z ktk $ */
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 pPacket = (ULONG)__FlatToStack(&idcpacket);
48
49#ifdef KEE
50 //NOTE: This isn't safe if the compiler uses ebp (or esp) to hold
51 // idc16_PddHandler, cmd or pPacket!! (works now though)
52 KernThunkStackTo16();
53//// KernSerialize16BitDD();
54#endif
55 rc = idc16_PddHandler(cmd, pPacket);
56#ifdef KEE
57//// KernUnserialize16BitDD();
58 KernThunkStackTo32();
59#endif
60
61 return rc;
62}
63//******************************************************************************
64//******************************************************************************
65BOOL OSS32_SetIrq(int irq, ULONG handler)
66{
67 return CallOSS16(IDC16_SETIRQ, irq, handler);
68}
69//******************************************************************************
70//******************************************************************************
71BOOL OSS32_FreeIrq(int irq)
72{
73 return CallOSS16(IDC16_FREEIRQ, irq, 0);
74}
75//******************************************************************************
76extern "C" int init_module();
77extern "C" void cleanup_module();
78//******************************************************************************
79BOOL OSS32_InitDriver()
80{
81 return init_module() == 0;
82}
83//******************************************************************************
84//Called during OS/2 shutdown
85//******************************************************************************
86void OSS32_RemoveDriver()
87{
88 cleanup_module();
89}
90//******************************************************************************
91//******************************************************************************
92extern "C" int OSS32_ProcessIRQ(int fWaveOut, unsigned long streamid)
93{
94 return CallOSS16(IDC16_PROCESS, fWaveOut, streamid);
95}
96//******************************************************************************
97//******************************************************************************
Note: See TracBrowser for help on using the repository browser.