ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/include/macos_util.h
Revision: 1.1
Committed: 1999-10-03T14:16:26Z (25 years, 1 month ago) by cebix
Content type: text/plain
Branch: MAIN
Branch point for: cebix
Log Message:
Initial revision

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * macos_util.h - MacOS definitions/utility functions
3     *
4     * Basilisk II (C) 1997-1999 Christian Bauer
5     *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21     #ifndef MACOS_UTIL_H
22     #define MACOS_UTIL_H
23    
24    
25     /*
26     * Queues
27     */
28    
29     enum { // Queue types
30     dummyType = 0,
31     vType = 1,
32     ioQType = 2,
33     drvQType = 3,
34     evType = 4,
35     fsQType = 5,
36     sIQType = 6,
37     dtQType = 7,
38     nmType = 8
39     };
40    
41     enum { // QElem struct
42     qLink = 0,
43     qType = 4,
44     qData = 6
45     };
46    
47     enum { // QHdr struct
48     qFlags = 0,
49     qHead = 2,
50     qTail = 6
51     };
52    
53    
54     /*
55     * Definitions for Device Manager
56     */
57    
58     // Error codes
59     enum {
60     noErr = 0,
61     controlErr = -17,
62     statusErr = -18,
63     readErr = -19,
64     writErr = -20,
65     badUnitErr = -21,
66     unitEmptyErr = -22,
67     openErr = -23,
68     closErr = -24,
69     abortErr = -27,
70     notOpenErr = -28,
71     ioErr = -36,
72     wPrErr = -44,
73     paramErr = -50,
74     nsDrvErr = -56,
75     noDriveErr = -64,
76     offLinErr = -65,
77     noNybErr = -66,
78     noAdrMkErr = -67,
79     dataVerErr = -68,
80     badCksmErr = -69,
81     badBtSlpErr = -70,
82     noDtaMkErr = -71,
83     badDCksum = -72,
84     badDBtSlp = -73,
85     wrUnderrun = -74,
86     cantStepErr = -75,
87     tk0BadErr = -76,
88     initIWMErr = -77,
89     twoSideErr = -78,
90     spdAdjErr = -79,
91     seekErr = -80,
92     sectNFErr = -81,
93     fmt1Err = -82,
94     fmt2Err = -83,
95     verErr = -84,
96     memFullErr = -108
97     };
98    
99     // Misc constants
100     enum {
101     goodbye = -1,
102    
103     ioInProgress = 1,
104     aRdCmd = 2,
105     aWrCmd = 3,
106     asyncTrpBit = 10,
107     noQueueBit = 9,
108    
109     dReadEnable = 0,
110     dWritEnable = 1,
111     dCtlEnable = 2,
112     dStatEnable = 3,
113     dNeedGoodBye = 4,
114     dNeedTime = 5,
115     dNeedLock = 6,
116    
117     dOpened = 5,
118     dRAMBased = 6,
119     drvrActive = 7,
120    
121     rdVerify = 64,
122    
123     fsCurPerm = 0,
124     fsRdPerm = 1,
125     fsWrPerm = 2,
126     fsRdWrPerm = 3,
127     fsRdWrShPerm = 4,
128    
129     fsAtMark = 0,
130     fsFromStart = 1,
131     fsFromLEOF = 2,
132     fsFromMark = 3,
133    
134     sony = 0,
135     hard20 = 1
136     };
137    
138     enum { // Large volume constants
139     kWidePosOffsetBit = 8,
140     kMaximumBlocksIn4GB = 0x007fffff
141     };
142    
143     enum { // IOParam struct
144     ioTrap = 6,
145     ioCmdAddr = 8,
146     ioCompletion = 12,
147     ioResult = 16,
148     ioNamePtr = 18,
149     ioVRefNum = 22,
150     ioRefNum = 24,
151     ioVersNum = 26,
152     ioPermssn = 27,
153     ioMisc = 28,
154     ioBuffer = 32,
155     ioReqCount = 36,
156     ioActCount = 40,
157     ioPosMode = 44,
158     ioPosOffset = 46,
159     ioWPosOffset = 46 // Wide positioning offset when ioPosMode has kWidePosOffsetBit set
160     };
161    
162     enum { // CntrlParam struct
163     csCode = 26,
164     csParam = 28
165     };
166    
167     enum { // DrvSts struct
168     dsTrack = 0,
169     dsWriteProt = 2,
170     dsDiskInPlace = 3,
171     dsInstalled = 4,
172     dsSides = 5,
173     dsQLink = 6,
174     dsQType = 10,
175     dsQDrive = 12,
176     dsQRefNum = 14,
177     dsQFSID = 16,
178     dsTwoSideFmt = 18,
179     dsNewIntf = 19,
180     dsDiskErrs = 20,
181     dsMFMDrive = 22,
182     dsMFMDisk = 23,
183     dsTwoMegFmt = 24
184     };
185    
186     enum { // DrvSts2 struct
187     dsDriveSize = 18,
188     dsDriveS1 = 20,
189     dsDriveType = 22,
190     dsDriveManf = 24,
191     dsDriveChar = 26,
192     dsDriveMisc = 28,
193     SIZEOF_DrvSts = 30
194     };
195    
196     enum { // DCtlEntry struct
197     dCtlDriver = 0,
198     dCtlFlags = 4,
199     dCtlQHdr = 6,
200     dCtlPosition = 16,
201     dCtlStorage = 20,
202     dCtlRefNum = 24,
203     dCtlCurTicks = 26,
204     dCtlWindow = 30,
205     dCtlDelay = 34,
206     dCtlEMask = 36,
207     dCtlMenu = 38,
208     dCtlSlot = 40,
209     dCtlSlotId = 41,
210     dCtlDevBase = 42,
211     dCtlOwner = 46,
212     dCtlExtDev = 50,
213     dCtlFillByte = 51,
214     dCtlNodeID = 52
215     };
216    
217    
218     /*
219     * Definitions for Deferred Task Manager
220     */
221    
222     enum { // DeferredTask struct
223     dtFlags = 6,
224     dtAddr = 8,
225     dtParam = 12,
226     dtReserved = 16
227     };
228    
229    
230     // Functions
231     extern void Enqueue(uint32 elem, uint32 list); // Enqueue QElem in list
232     extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num"
233     extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h)
234     extern bool HasMacStarted(void); // Test if basic MacOS initializations are done
235     extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes
236    
237     #endif