|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /**
26: * Copyright (c) 1994-1996 NeXT Software, Inc. All rights reserved.
27: * Copyright ) 1997 Apple Computer Inc. All Rights Reserved.
28: * @author Martin Minow mailto:[email protected]
29: * @revision 1997.02.13 Initial conversion from AMDPCSCSIDriver sources.
30: *
31: * Set tabs every 4 characters.
32: *
33: * DDM macros for Apple 53C96 SCSI driver.
34: * Apple96SCSI is closely based on Doug Mitchell's AMD 53C974/79C974 driver.
35: *
36: * Edit History
37: * 1997.02.13 MM Initial conversion from AMDPCSCSIDriver sources.
38: * 1997.03.24 MM Normalize Apple96DDM.h and AppleMeshDDM.h.
39: */
40:
41: #import <driverkit/debugging.h>
42: // #import <kernserv/ns_timer.h>
43: #import "Timestamp.h"
44:
45: /*
46: * The index into IODDMMasks[].
47: */
48: #define APPLE96_DDM_INDEX 2
49:
50: #define DDM_EXPORTED 0x00000001 // exported methods
51: #define DDM_IOTHREAD 0x00000002 // I/O thread methods
52: #define DDM_INIT 0x00000004 // Initialization
53: #define DDM_INTR 0x00000008 // Interrupt
54: #define DDM_CHIP 0x00000010 // chip-level
55: #define DDM_ERROR 0x00000020 // error
56: #define DDM_DMA 0x00000040 // DMA
57: #define DDM_ENTRY 0x00000010 // method entry and exit
58: #
59: #define DDM_CONSOLE_LOG 0 /* really hosed...*/
60:
61: #if APPLE96_ALWAYS_ASSERT
62: #undef ASSERT
63: #define ASSERT(what) do { if (!(what)) IOLog("Assert \"%s\" at %s, %d\n", #what, __FILE__, __LINE__); } while (0)
64: #endif
65: #if DDM_CONSOLE_LOG
66: #undef IODEBUG
67: #define IODEBUG(index, mask, x, a, b, c, d, e) { \
68: if (IODDMMasks[index] & mask) { \
69: IOLog(x, a, b, c,d, e); \
70: } \
71: }
72: #endif /* DDM_CONSOLE_LOG */
73: #if VERY_SERIOUS_DEBUGGING /* TEMP for initial debug */
74: #undef IODEBUG
75: #define IODEBUG(index, mask, x, a, b, c, d, e) printf(x, a, b, c, d, e)
76: #endif /* TEMP */
77:
78: /*
79: * Normal ddm calls..
80: */
81: #define ddmExported(x, a, b, c, d, e) \
82: IODEBUG(APPLE96_DDM_INDEX, DDM_EXPORTED, x, a, b, c, d, e)
83:
84: #define ddmThread(x, a, b, c, d, e) \
85: IODEBUG(APPLE96_DDM_INDEX, DDM_IOTHREAD, x, a, b, c, d, e)
86:
87: #define ddmInit(x, a, b, c, d, e) \
88: IODEBUG(APPLE96_DDM_INDEX, DDM_INIT, x, a, b, c, d, e)
89:
90: #define ddmEntry(x, a, b, c, d, e) \
91: IODEBUG(APPLE96_DDM_INDEX, DDM_ENTRY, x, a, b, c, d, e)
92:
93: /*
94: * catch both I/O thread events and interrupt events.
95: */
96: #define ddmInterrupt(x, a, b, c, d, e) \
97: IODEBUG(APPLE96_DDM_INDEX, (DDM_IOTHREAD | DDM_INTR), x, a, b, c, d, e)
98:
99: #define ddmChip(x, a, b, c, d, e) \
100: IODEBUG(APPLE96_DDM_INDEX, DDM_CHIP, x, a, b, c, d, e)
101:
102: #define ddmError(x, a, b, c, d, e) \
103: IODEBUG(APPLE96_DDM_INDEX, DDM_ERROR, x, a, b, c, d, e)
104:
105: #define ddmDMA(x, a, b, c, d, e) \
106: IODEBUG(APPLE96_DDM_INDEX, DDM_DMA, x, a, b, c, d, e)
107:
108: /*
109: * Method entry/exit traces. Note that these have unbalanced
110: * parentheses in order to enforce a single exit point and
111: * provide for method timing. By convention, the first three
112: * bytes of the "what" string will be used for timestamping,
113: * so make them unique (at the expense of readability).
114: */
115: #if 0 && DDM_DEBUG // TEMP for initial debugging
116: #define ENTRY(what) do { \
117: const char *__tag__ = (what); \
118: StoreTimestamp(OSTag('+', __tag__), 0); \
119: ddmEntry("+%s\n", __tag__, 2, 3, 4, 5); \
120: do {
121: #define EXIT() } while(0); \
122: StoreTimestamp(OSTag('-', __tag__), 0); \
123: ddmEntry("-%s\n", __tag__, 2, 3, 4, 5); \
124: } while (0)
125: #define TAG(name, value) RAW_TAG(OSTag('*', name), value)
126: #define RAW_TAG(tag, value) do { \
127: StoreTimestamp((tag), (UInt32) (value)); \
128: } while (0)
129: #define RESULT(result) } while(0); \
130: StoreTimestamp(OSTag('-', __tag__), (UInt32) (result)); \
131: ddmEntry("=%s %08x, %8u %8d\n", __tag__, \
132: (UInt32) (result), \
133: (UInt32) (result), \
134: (int) (result), \
135: 5); \
136: } while (0)
137: #else /* No DDM_DEBUG */
138: #define ENTRY(what) do { \
139: const char *__tag__ = (what); \
140: StoreTimestamp(OSTag('+', __tag__), 0); \
141: do {
142: #define EXIT() } while(0); \
143: StoreTimestamp(OSTag('-', __tag__), 0); \
144: } while (0)
145: #define TAG(name, value) RAW_TAG(OSTag('*', name), value)
146: #define RAW_TAG(tag, value) do { \
147: StoreTimestamp((tag), (UInt32) (value)); \
148: } while (0)
149: #define RESULT(result) } while(0); \
150: StoreTimestamp(OSTag('-', __tag__), (UInt32) (result)); \
151: } while (0)
152: #endif /* DDM_DEBUG */
153:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.