source: GPL/branches/DAZ/drv32/strategy.c@ 580

Last change on this file since 580 was 580, checked in by David Azarewicz, 11 years ago

Cleanup build environment

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