source: sbliveos2/trunk/drv32/idc.c@ 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: 4.0 KB
Line 
1/* $Id: idc.c 142 2000-04-23 14:55:46Z ktk $ */
2
3//******************************************************************************
4// IDC entrypoint (all calls from 16 bits MMPM2 driver end up here)
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//******************************************************************************
24extern "C" { // 16-bit header files are not C++ aware
25#define INCL_NOPMAPI
26#define INCL_DOSINFOSEG
27#include <os2.h>
28}
29#include <devtype.h>
30#include <devhelp.h>
31#include <strategy.h>
32#include <ossidc.h>
33#include <irqos2.h>
34#include <stacktoflat.h>
35
36//16:32 address of 16 bits pdd idc handler
37IDC16_HANDLER idc16_PddHandler = 0;
38
39WORD32 OSS32IDC(ULONG cmd, PIDC32_PACKET pPacket);
40
41//packet pointer must reference a structure on the stack
42
43WORD32 SBLive32IDC(ULONG cmd, ULONG packet);
44#pragma aux SBLive32IDC "SBLIVE_IDC" parm reverse [ecx edx]
45WORD32 SBLive32IDC(ULONG cmd, ULONG packet)
46{
47 PIDC32_PACKET pPacket = (PIDC32_PACKET)__StackToFlat(packet);
48 ULONG oldfileid;
49 WORD32 rc;
50
51 //Sets file id in current task structure
52 oldfileid = OSS32_SetFileId(pPacket->fileid);
53 rc = OSS32IDC(cmd & 0xFFFF, pPacket);
54 OSS32_SetFileId(oldfileid);
55 return rc;
56}
57
58WORD32 OSS32IDC(ULONG cmd, PIDC32_PACKET pPacket)
59{
60 switch(cmd)
61 {
62 case IDC32_INIT:
63 idc16_PddHandler = (IDC16_HANDLER)__Make48Pointer(pPacket->init.handler16);
64 return OSS32_InitDriver();
65
66 case IDC32_EXIT:
67 idc16_PddHandler = 0;
68 return TRUE;
69
70 case IDC32_IRQ:
71 return oss_process_interrupt(pPacket->irq.irqnr);
72
73 case IDC32_STREAM_OPEN:
74 return OSS32_StreamOpen(pPacket->open.streamtype);
75
76 case IDC32_STREAM_CLOSE:
77 return OSS32_StreamClose(pPacket->close.streamtype, pPacket->close.streamid);
78
79 case IDC32_STREAM_ADDBUFFER:
80 return OSS32_StreamAddBuffer(pPacket->buffer.streamtype, pPacket->buffer.streamid, pPacket->buffer.buffer, pPacket->buffer.size);
81
82 case IDC32_STREAM_PAUSE:
83 break;
84
85 case IDC32_STREAM_START:
86 {
87 ULONG fStart = TRUE;
88
89#ifdef KEE
90 return OSS32_StreamTrigger(pPacket->startstop.streamtype, pPacket->startstop.streamid, (ULONG *)&fStart);
91#else
92 return OSS32_StreamTrigger(pPacket->startstop.streamtype, pPacket->startstop.streamid, (ULONG NEAR *)__StackToFlat((ULONG)&fStart));
93#endif
94 }
95
96 case IDC32_STREAM_STOP:
97 {
98 ULONG fStart = FALSE;
99
100#ifdef KEE
101 return OSS32_StreamTrigger(pPacket->startstop.streamtype, pPacket->startstop.streamid, (ULONG *)&fStart);
102#else
103 return OSS32_StreamTrigger(pPacket->startstop.streamtype, pPacket->startstop.streamid, (ULONG NEAR *)__StackToFlat((ULONG)&fStart));
104#endif
105 }
106
107 case IDC32_STREAM_RESET:
108 return OSS32_StreamReset(pPacket->startstop.streamtype, pPacket->startstop.streamid);
109
110 case IDC32_STREAM_IOCTL:
111 switch(pPacket->ioctl.cmd) {
112 case IOCTL_SETFORMAT:
113 {
114 FORMAT_INFO NEAR *pFormatInfo = (FORMAT_INFO NEAR *)__StackToFlat(pPacket->ioctl.ioctl_param);
115
116 return OSS32_StreamSetFormat(pPacket->ioctl.streamtype, pPacket->ioctl.streamid, pPacket->ioctl.cmd, pFormatInfo);
117 }
118 default:
119 return OSS32_StreamIOCtl(pPacket->ioctl.streamtype, pPacket->ioctl.streamid, pPacket->ioctl.cmd, (char NEAR *)__StackToFlat(pPacket->ioctl.ioctl_param));
120 }
121 case IDC32_STREAM_MIXER:
122 return OSS32_SetVolume(pPacket->mixer.streamtype, pPacket->mixer.streamid, pPacket->mixer.cmd, pPacket->mixer.volume);
123 }
124 return 0;
125}
Note: See TracBrowser for help on using the repository browser.