source: GPL/branches/uniaud32-2.1.x/drv32/strategy.c@ 546

Last change on this file since 546 was 546, checked in by David Azarewicz, 14 years ago

interrupt fixes

File size: 6.0 KB
Line 
1/* $Id: strategy.c,v 1.1.1.1 2003/07/02 13:56:56 eleph Exp $ */
2/*
3 * Strategy entry point
4 *
5 * (C) 2000-2002 InnoTek Systemberatung GmbH
6 * (C) 2000-2001 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
25#define INCL_NOPMAPI
26#define INCL_DOSINFOSEG // Need Global info seg in rm.cpp algorithms
27#include <os2.h>
28
29#include <devhelp.h>
30#include <devrp.h>
31#include <devown.h>
32#include "strategy.h"
33#include <ossidc32.h>
34#include <dbgos2.h>
35
36ULONG StratRead(RP __far *_rp);
37ULONG StratIOCtl(RP __far *_rp);
38ULONG StratClose(RP __far *_rp);
39
40ULONG DiscardableInit(RPInit __far*);
41ULONG deviceOwner = DEV_NO_OWNER;
42ULONG numOS2Opens = 0;
43
44//******************************************************************************
45//******************************************************************************
46ULONG StratOpen(RP __far*)
47{
48 if (numOS2Opens == 0) {
49 deviceOwner = DEV_PDD_OWNER;
50 }
51 numOS2Opens++;
52 return RPDONE;
53}
54//******************************************************************************
55//******************************************************************************
56#pragma off (unreferenced)
57static ULONG StratWrite(RP __far* _rp)
58#pragma on (unreferenced)
59{
60 return RPDONE | RPERR;
61}
62//******************************************************************************
63// External initialization entry-point
64//******************************************************************************
65ULONG StratInit(RP __far* _rp)
66{
67 ULONG rc;
68
69 RPInit __far* rp = (RPInit __far*)_rp;
70 rc = DiscardableInit(rp);
71 //dprintf(("StratInit End rc=%d", rc));
72 return rc;
73}
74//******************************************************************************
75// External initialization complete entry-point
76#ifdef ACPI
77#include "irqos2.h"
78#endif //ACPI
79//******************************************************************************
80#pragma off (unreferenced)
81ULONG StratInitComplete(RP __far* _rp)
82#pragma on (unreferenced)
83{
84#ifdef ACPI
85 PciAdjustInterrupts();
86#endif
87 //dprintf(("StratInitComplete"));
88 return(RPDONE);
89}
90//******************************************************************************
91//******************************************************************************
92#pragma off (unreferenced)
93ULONG StratShutdown(RP __far *_rp)
94#pragma on (unreferenced)
95{
96 RPShutdown __far *rp = (RPShutdown __far *)_rp;
97
98 //dprintf(("StratShutdown %d", rp->Function));
99 if(rp->Function == 1) {//end of shutdown
100 OSS32_Shutdown();
101 }
102 return(RPDONE);
103}
104//******************************************************************************
105//******************************************************************************
106// Handle unsupported requests
107static ULONG StratError(RP __far*)
108{
109 return RPERR_COMMAND | RPDONE;
110}
111//******************************************************************************
112// Strategy dispatch table
113//
114// This table is used by the strategy routine to dispatch strategy requests
115//******************************************************************************
116typedef ULONG (*RPHandler)(RP __far* rp);
117RPHandler StratDispatch[] =
118{
119 StratInit, // 00 (BC): Initialization
120 StratError, // 01 (B ): Media check
121 StratError, // 02 (B ): Build BIOS parameter block
122 StratError, // 03 ( ): Unused
123 StratRead, // 04 (BC): Read
124 StratError, // 05 ( C): Nondestructive read with no wait
125 StratError, // 06 ( C): Input status
126 StratError, // 07 ( C): Input flush
127 StratWrite, // 08 (BC): Write
128 StratError, // 09 (BC): Write verify
129 StratError, // 0A ( C): Output status
130 StratError, // 0B ( C): Output flush
131 StratError, // 0C ( ): Unused
132 StratOpen, // 0D (BC): Open
133 StratClose, // 0E (BC): Close
134 StratError, // 0F (B ): Removable media check
135 StratIOCtl, // 10 (BC): IO Control
136 StratError, // 11 (B ): Reset media
137 StratError, // 12 (B ): Get logical unit
138 StratError, // 13 (B ): Set logical unit
139 StratError, // 14 ( C): Deinstall character device driver
140 StratError, // 15 ( ): Unused
141 StratError, // 16 (B ): Count partitionable fixed disks
142 StratError, // 17 (B ): Get logical unit mapping of fixed disk
143 StratError, // 18 ( ): Unused
144 StratError, // 19 ( ): Unused
145 StratError, // 1A ( ): Unused
146 StratError, // 1B ( ): Unused
147 StratShutdown, // 1C (BC): Notify start or end of system shutdown
148 StratError, // 1D (B ): Get driver capabilities
149 StratError, // 1E ( ): Unused
150 StratInitComplete // 1F (BC): Notify end of initialization
151};
152//******************************************************************************
153// Strategy entry point
154//
155// The strategy entry point must be declared according to the STRATEGY
156// calling convention, which fetches arguments from the correct registers.
157//******************************************************************************
158ULONG Strategy(RP __far* rp);
159#pragma aux (STRATEGY) Strategy "ALSA_STRATEGY";
160ULONG Strategy(RP __far* rp)
161{
162 if (rp->Command < sizeof(StratDispatch)/sizeof(StratDispatch[0]))
163 return(StratDispatch[rp->Command](rp));
164 else return(RPERR_COMMAND | RPDONE);
165}
166//******************************************************************************
167//******************************************************************************
Note: See TracBrowser for help on using the repository browser.