xref: /titanic_51/usr/src/cmd/cdrw/mmc.h (revision fb9f9b975cb9214fec5dab37d461199adab9b964)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MMC_H
28 #define	_MMC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* bytelengths for some SCSI data structures */
37 #define	SENSE_DATA_SIZE		16
38 #define	TRACK_INFO_SIZE		36
39 #define	DISC_INFO_BLOCK_SIZE	32
40 #define	INQUIRY_DATA_LENGTH	96
41 #define	GET_PERF_DATA_LEN	24
42 #define	SET_STREAM_DATA_LEN	28
43 
44 #define	DEFAULT_SCSI_TIMEOUT	60
45 
46 int test_unit_ready(int fd);
47 int inquiry(int fd, uchar_t *inq);
48 int read_capacity(int fd, uchar_t *capbuf);
49 int read_track_info(int fd, int trackno, uchar_t *ti);
50 int mode_sense(int fd, uchar_t pc, int dbd, int page_len, uchar_t *buffer);
51 int mode_select(int fd, int page_len, uchar_t *buffer);
52 int read_toc(int fd, int format, int trackno, int buflen, uchar_t *buf);
53 int read_disc_info(int fd, uchar_t *di);
54 int get_configuration(int fd, uint16_t feature, int bufsize, uchar_t *buf);
55 int read10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
56     uint32_t bufsize);
57 int write10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
58     uint32_t bufsize);
59 int close_track(int fd, int trackno, int close_session, int immediate);
60 int blank_disc(int fd, int type, int immediate);
61 int read_cd(int fd, uint32_t start_blk, uint16_t nblk, uchar_t sector_type,
62     uchar_t *buf, uint32_t bufsize);
63 int load_unload(int fd, int load);
64 int prevent_allow_mr(int fd, int op);
65 int read_header(int fd, uint32_t lba, uchar_t *buf);
66 int set_cd_speed(int fd, uint16_t read_speed, uint16_t write_speed);
67 int get_performance(int fd, int get_write_performance, uchar_t *perf);
68 int set_streaming(int fd, uchar_t *buf);
69 int rezero_unit(int fd);
70 int start_stop(int fd, int start);
71 int flush_cache(int fd);
72 int set_reservation(int fd, ulong_t size);
73 int format_media(int fd);
74 uint32_t read_format_capacity(int fd, uint_t *bsize);
75 
76 int uscsi_error;		/* used for debugging failed uscsi */
77 
78 #define	REZERO_UNIT_CMD 	0x01
79 #define	FORMAT_UNIT_CMD		0x04
80 #define	INQUIRY_CMD		0x12
81 #define	MODE_SELECT_6_CMD	0x15
82 #define	MODE_SENSE_6_CMD	0x1A
83 #define	START_STOP_CMD		0x1B
84 #define	PREVENT_ALLOW_CMD	0x1E
85 #define	READ_FORMAT_CAP_CMD	0x23
86 #define	READ_CAP_CMD		0x25
87 #define	READ_10_CMD		0x28
88 #define	WRITE_10_CMD		0x2A
89 #define	SYNC_CACHE_CMD		0x35
90 #define	READ_TOC_CMD		0x43
91 #define	MODE_SELECT_10_CMD	0x55
92 #define	MODE_SENSE_10_CMD	0x5A
93 #define	READ_HDR_CMD		0x44
94 #define	GET_CONFIG_CMD		0x46
95 
96 #define	READ_INFO_CMD		0x51
97 #define	READ_TRACK_CMD		0x52
98 #define	SET_RESERVATION_CMD	0x53
99 #define	CLOSE_TRACK_CMD		0x5B
100 
101 #define	BLANK_CMD		0xA1
102 #define	GET_PERFORMANCE_CMD	0xAC
103 #define	READ_DVD_STRUCTURE	0xAD
104 #define	READ_CD_CMD		0xBE
105 #define	SET_CD_SPEED		0xBB
106 
107 #define	STREAM_CMD		0xB6
108 #define	READ_AUDIO_CMD		0xD8
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif /* _MMC_H */
115