xref: /titanic_50/usr/src/cmd/cdrw/device.h (revision 554ff184129088135ad2643c1c9832174a17be88)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_DEVICE_H
28 #define	_DEVICE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 
38 #include "bstream.h"
39 
40 #define	DEFAULT_CAPACITY	(74*60*75)
41 
42 #define	DEV_CAP_EXTRACT_CDDA			1
43 #define	DEV_CAP_ACCURATE_CDDA			2
44 #define	DEV_CAP_SETTING_SPEED_NOT_ALLOWED	4
45 
46 typedef struct _device {
47 	char		*d_node;
48 	char		*d_name;
49 	int		d_fd;
50 	uint_t		d_blksize;
51 	uchar_t		*d_inq;
52 	uint32_t	d_cap;
53 	int		(*d_read_audio)(struct _device *dev, uint_t start_blk,
54 			    uint_t nblks, uchar_t *buf);
55 	int		(*d_speed_ctrl)(struct _device *dev, int cmd,
56 			    int speed);
57 } cd_device;
58 
59 /*
60  * Speed commands
61  */
62 #define	GET_READ_SPEED	1
63 #define	SET_READ_SPEED	2
64 #define	GET_WRITE_SPEED	3
65 #define	SET_WRITE_SPEED	4
66 
67 #define	SCAN_ALL_CDS		0x00	/* scan and return all cd devices */
68 #define	SCAN_WRITERS		0x01	/* select only writable devices */
69 #define	SCAN_LISTDEVS		0x02	/* print out device listing */
70 
71 #define	DVD_CONFIG_SIZE		0x20
72 
73 cd_device *get_device(char *user_supplied, char *node);
74 int lookup_device(char *supplied, char *found);
75 void fini_device(cd_device *dev);
76 int scan_for_cd_device(int mode, cd_device **found);
77 void write_next_track(int mode, bstreamhandle h);
78 int check_device(cd_device *dev, int cond);
79 void get_media_type(int fd);
80 
81 #ifdef	__cplusplus
82 }
83 #endif
84 
85 #endif /* _DEVICE_H */
86