AmendHub

Download

akuker

/

scsi_test

/

AsyncSCSIPresent.c

 

(View History)

akuker   More files and stuff Latest amendment: 3 on 2022-08-21

1 /* AsyncSCSIPresent.c */
2 /*
3 * AsyncSCSIPresent.c
4 * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved.
5 */
6 #include <OSUtils.h>
7 #include <Traps.h>
8 #ifndef _SCSIAtomic
9 /*
10 * This is needed if you don't have Universal Headers.
11 */
12 #define _SCSIAtomic 0xA089
13 #endif
14
15 Boolean AsyncSCSIPresent(void);
16 static Boolean TrapAvailable(
17 short theTrap
18 );
19
20 Boolean
21 AsyncSCSIPresent(void)
22 {
23 return (TrapAvailable(_SCSIAtomic));
24 }
25
26 /*
27 * TrapAvailable (see Inside Mac VI 3-8)
28 */
29 #define NumToolboxTraps() ( \
30 (NGetTrapAddress(_InitGraf, ToolTrap) \
31 == NGetTrapAddress(0xAA6E, ToolTrap)) \
32 ? 0x200 : 0x400 \
33 )
34 #define GetTrapType(theTrap) ( \
35 (((theTrap) & 0x0800) != 0) ? ToolTrap : OSTrap \
36 )
37
38 static Boolean
39 TrapAvailable(
40 short theTrap
41 )
42 {
43 TrapType trapType;
44
45 trapType = GetTrapType(theTrap);
46 if (trapType == ToolTrap) {
47 theTrap &= 0x07FF;
48 if (theTrap >= NumToolboxTraps())
49 theTrap = _Unimplemented;
50 }
51 return (
52 NGetTrapAddress(theTrap, trapType)
53 != NGetTrapAddress(_Unimplemented, ToolTrap)
54 );
55 }