|
|
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: // Copyright 1997 by Apple Computer, Inc., all rights reserved.
26: /*
27: * Copyright (c) 1994-1997 NeXT Software, Inc. All rights reserved.
28: *
29: * atapi_external.h - External definitions for ATAPI driver.
30: *
31: * HISTORY
32: * 1-Sep-1994 Rakesh Dubey at NeXT
33: * Created.
34: */
35:
36:
37: #ifdef DRIVER_PRIVATE
38:
39: #ifndef _BSD_DEV_ATAPI_EXTERN_
40: #define _BSD_DEV_ATAPI_EXTERN_
41:
42: #import <sys/types.h>
43: #import <sys/ioctl.h>
44: #if (IO_DRIVERKIT_VERSION == 330)
45: #ifdef KERNEL
46: #import <machdep/machine/pmap.h>
47: #import <vm/vm_map.h>
48: #endif KERNEL
49: #endif
50: #import <mach/boolean.h>
51: #import <mach/vm_param.h>
52:
53: /*
54: * How does the device respond to an ATAPI packet command.
55: */
56: #define ATAPI_CMD_DRQ_INT 0x01
57: #define ATAPI_CMD_DRQ_SLOW 0x00
58: #define ATAPI_CMD_DRQ_FAST 0x02
59:
60: #define ATAPI_DEVICE_DIRECT_ACCESS 0x00
61: #define ATAPI_DEVICE_CD_ROM 0x05
62: #define ATAPI_DEVICE_OPTICAL 0x07
63: #define ATAPI_DEVICE_TAPE 0x01
64: #define ATAPI_DEVICE_UNKNOWN 0x1f
65:
66: /*
67: * ATAPI commands -- as defined in the SFF-8020, Revison 1.2
68: */
69:
70: /*
71: * Mandatory commands.
72: */
73: #define ATAPI_PACKET 0xa0
74: #define ATAPI_IDENTIFY_DRIVE 0xa1
75: #define ATAPI_SOFT_RESET 0x08
76:
77:
78: typedef int atapi_return_t;
79:
80: /*
81: * Defines for ATAPI error register. Upper four bits are sense key.
82: */
83: #define MEDIA_CHANGE_REQUEST 0x08
84: #define CMD_ABORTED 0x04
85: #define END_OF_MEDIA 0x02
86: #define ILLEGAL_LENGTH 0x01
87:
88: /*
89: * Defines for the feature register.
90: */
91: #define DMA_TRANSFERS 0x01
92:
93: /*
94: * Defines for the interrupt reason register.
95: */
96: #define IO_DIRECTION 0x02 /* 1 --> to host */
97: #define CMD_OR_DATA 0x01 /* 0 --> user data */
98:
99: /*
100: * Other defines are same as in the case of ATA standard. TBD: Should we
101: * redefine all ATAPI registers to keep things completely separate?
102: */
103:
104:
105: /*
106: * ATAPI General configuration register.
107: */
108: typedef struct _atapiGenConfig {
109: unsigned short
110: protocolType:2, /* */
111: rsvd2:1, /* */
112: deviceType:5, /* */
113: removable:1, /* */
114: cmdDrqType:2, /* */
115: rsvd1:3, /* */
116: cmdPacketSize:2; /* */
117: } atapiGenConfig_t;
118:
119: /*
120: * ATAPI sense keys, page 157 SFF-8020, Rev 1.2
121: */
122: #define ATAPI_SENSE_NONE 0x00
123: #define ATAPI_SENSE_RECOVERED_ERROR 0x01
124: #define ATAPI_SENSE_NOT_READY 0x02
125: #define ATAPI_SENSE_MEDIUM_ERROR 0x03
126: #define ATAPI_SENSE_HARDWARE_ERROR 0x04
127: #define ATAPI_SENSE_ILLEGAL_REQUEST 0x05
128: #define ATAPI_SENSE_UNIT_ATTENTION 0x06
129: #define ATAPI_SENSE_DATA_PROTECT 0x07
130: #define ATAPI_SENSE_ABORTED_COMMAND 0x0b
131: #define ATAPI_SENSE_MISCOMPARE 0x0e
132:
133: #endif _BSD_DEV_ATAPI_EXTERN_
134:
135: #endif DRIVER_PRIVATE
136:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.