xref: /titanic_53/usr/src/cmd/cdrw/mmc.h (revision c9be8e6927b04a66019760ddf9c3e0d0b91f2451)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*c9be8e69Sec158148  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_MMC_H
287c478bd9Sstevel@tonic-gate #define	_MMC_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
3698584592Sarutz /* bytelengths for some SCSI data structures */
377c478bd9Sstevel@tonic-gate #define	SENSE_DATA_SIZE		16
387c478bd9Sstevel@tonic-gate #define	TRACK_INFO_SIZE		36
397c478bd9Sstevel@tonic-gate #define	DISC_INFO_BLOCK_SIZE	32
407c478bd9Sstevel@tonic-gate #define	INQUIRY_DATA_LENGTH	96
417c478bd9Sstevel@tonic-gate #define	GET_PERF_DATA_LEN	24
427c478bd9Sstevel@tonic-gate #define	SET_STREAM_DATA_LEN	28
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define	DEFAULT_SCSI_TIMEOUT    60
457c478bd9Sstevel@tonic-gate 
46*c9be8e69Sec158148 #define	MMC_FTR_HDR_LEN		8	/* byte len of Feature Header */
47*c9be8e69Sec158148 /*
48*c9be8e69Sec158148  * byte length of the static part of a Feature Descriptor
49*c9be8e69Sec158148  */
50*c9be8e69Sec158148 #define	MMC_FTR_DSCRPTR_BASE_LEN	4
51*c9be8e69Sec158148 #define	MMC_PRFL_DSCRPTR_LEN	4	/* byte len of Profile Descriptor */
52*c9be8e69Sec158148 /*
53*c9be8e69Sec158148  * MMC Features; can be added to over time
54*c9be8e69Sec158148  */
55*c9be8e69Sec158148 #define	MMC_FTR_PRFL_LIST	0x0000	/* Profile List Feature */
56*c9be8e69Sec158148 #define	MMC_FTR_CORE		0x0001	/* Core Feature */
57*c9be8e69Sec158148 #define	MMC_FTR_MORPHING	0x0002	/* Morphing Feature */
58*c9be8e69Sec158148 #define	MMC_FTR_REM_MED		0x0003	/* Removable Medium Feature */
59*c9be8e69Sec158148 #define	MMC_FTR_WR_PROTECT	0x0004	/* Write Protect Feature */
60*c9be8e69Sec158148 #define	MMC_FTR_RAND_READ	0x0010	/* Random Readable Feature */
61*c9be8e69Sec158148 #define	MMC_FTR_MULTI_READ	0x001D	/* Multi-Read Feature */
62*c9be8e69Sec158148 #define	MMC_FTR_CD_READ		0x001E	/* CD Read Feature */
63*c9be8e69Sec158148 #define	MMC_FTR_DVD_READ	0x001F	/* DVD Read Feature */
64*c9be8e69Sec158148 #define	MMC_FTR_RAND_WR		0x0020	/* Random Writable Feature */
65*c9be8e69Sec158148 #define	MMC_FTR_INC_STR_WR	0x0021	/* Incremental Streaming Writable */
66*c9be8e69Sec158148 #define	MMC_FTR_SCTR_ERSBL	0x0022	/* Sector Erasable Feature */
67*c9be8e69Sec158148 #define	MMC_FTR_FORMATTABLE	0x0023	/* Formattable Feature */
68*c9be8e69Sec158148 #define	MMC_FTR_DFCT_MNGMNT	0x0024	/* Hardware Defect Management Feature */
69*c9be8e69Sec158148 #define	MMC_FTR_RT_STREAM	0x0107	/* Real Time Streaming Feature */
70*c9be8e69Sec158148 
717c478bd9Sstevel@tonic-gate int test_unit_ready(int fd);
727c478bd9Sstevel@tonic-gate int inquiry(int fd, uchar_t *inq);
737c478bd9Sstevel@tonic-gate int read_capacity(int fd, uchar_t *capbuf);
747c478bd9Sstevel@tonic-gate int read_track_info(int fd, int trackno, uchar_t *ti);
757c478bd9Sstevel@tonic-gate int mode_sense(int fd, uchar_t pc, int dbd, int page_len, uchar_t *buffer);
767c478bd9Sstevel@tonic-gate int mode_select(int fd, int page_len, uchar_t *buffer);
777c478bd9Sstevel@tonic-gate int read_toc(int fd, int format, int trackno, int buflen, uchar_t *buf);
787c478bd9Sstevel@tonic-gate int read_disc_info(int fd, uchar_t *di);
797c478bd9Sstevel@tonic-gate int get_configuration(int fd, uint16_t feature, int bufsize, uchar_t *buf);
807c478bd9Sstevel@tonic-gate int read10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
817c478bd9Sstevel@tonic-gate     uint32_t bufsize);
827c478bd9Sstevel@tonic-gate int write10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
837c478bd9Sstevel@tonic-gate     uint32_t bufsize);
847c478bd9Sstevel@tonic-gate int close_track(int fd, int trackno, int close_session, int immediate);
857c478bd9Sstevel@tonic-gate int blank_disc(int fd, int type, int immediate);
867c478bd9Sstevel@tonic-gate int read_cd(int fd, uint32_t start_blk, uint16_t nblk, uchar_t sector_type,
877c478bd9Sstevel@tonic-gate     uchar_t *buf, uint32_t bufsize);
887c478bd9Sstevel@tonic-gate int load_unload(int fd, int load);
897c478bd9Sstevel@tonic-gate int prevent_allow_mr(int fd, int op);
907c478bd9Sstevel@tonic-gate int read_header(int fd, uint32_t lba, uchar_t *buf);
917c478bd9Sstevel@tonic-gate int set_cd_speed(int fd, uint16_t read_speed, uint16_t write_speed);
927c478bd9Sstevel@tonic-gate int get_performance(int fd, int get_write_performance, uchar_t *perf);
937c478bd9Sstevel@tonic-gate int set_streaming(int fd, uchar_t *buf);
947c478bd9Sstevel@tonic-gate int rezero_unit(int fd);
957c478bd9Sstevel@tonic-gate int start_stop(int fd, int start);
967c478bd9Sstevel@tonic-gate int flush_cache(int fd);
977c478bd9Sstevel@tonic-gate int set_reservation(int fd, ulong_t size);
987c478bd9Sstevel@tonic-gate int format_media(int fd);
997c478bd9Sstevel@tonic-gate uint32_t read_format_capacity(int fd, uint_t *bsize);
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate int uscsi_error;		/* used for debugging failed uscsi */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #define	REZERO_UNIT_CMD 	0x01
1047c478bd9Sstevel@tonic-gate #define	FORMAT_UNIT_CMD		0x04
1057c478bd9Sstevel@tonic-gate #define	INQUIRY_CMD		0x12
1067c478bd9Sstevel@tonic-gate #define	MODE_SELECT_6_CMD	0x15
1077c478bd9Sstevel@tonic-gate #define	MODE_SENSE_6_CMD	0x1A
1087c478bd9Sstevel@tonic-gate #define	START_STOP_CMD		0x1B
1097c478bd9Sstevel@tonic-gate #define	PREVENT_ALLOW_CMD	0x1E
1107c478bd9Sstevel@tonic-gate #define	READ_FORMAT_CAP_CMD	0x23
1117c478bd9Sstevel@tonic-gate #define	READ_CAP_CMD		0x25
1127c478bd9Sstevel@tonic-gate #define	READ_10_CMD		0x28
1137c478bd9Sstevel@tonic-gate #define	WRITE_10_CMD		0x2A
1147c478bd9Sstevel@tonic-gate #define	SYNC_CACHE_CMD		0x35
1157c478bd9Sstevel@tonic-gate #define	READ_TOC_CMD		0x43
1167c478bd9Sstevel@tonic-gate #define	MODE_SELECT_10_CMD	0x55
1177c478bd9Sstevel@tonic-gate #define	MODE_SENSE_10_CMD	0x5A
1187c478bd9Sstevel@tonic-gate #define	READ_HDR_CMD		0x44
1197c478bd9Sstevel@tonic-gate #define	GET_CONFIG_CMD		0x46
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #define	READ_INFO_CMD		0x51
1227c478bd9Sstevel@tonic-gate #define	READ_TRACK_CMD		0x52
1237c478bd9Sstevel@tonic-gate #define	SET_RESERVATION_CMD	0x53
1247c478bd9Sstevel@tonic-gate #define	CLOSE_TRACK_CMD		0x5B
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #define	BLANK_CMD		0xA1
1277c478bd9Sstevel@tonic-gate #define	GET_PERFORMANCE_CMD	0xAC
1287c478bd9Sstevel@tonic-gate #define	READ_DVD_STRUCTURE	0xAD
1297c478bd9Sstevel@tonic-gate #define	READ_CD_CMD		0xBE
1307c478bd9Sstevel@tonic-gate #define	SET_CD_SPEED		0xBB
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate #define	STREAM_CMD		0xB6
1337c478bd9Sstevel@tonic-gate #define	READ_AUDIO_CMD		0xD8
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1367c478bd9Sstevel@tonic-gate }
1377c478bd9Sstevel@tonic-gate #endif
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate #endif /* _MMC_H */
140