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