xref: /titanic_50/usr/src/cmd/cdrw/device.h (revision 3895f3e681d42b8122c8084f114c0d2f88dd7979)
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 2006 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 typedef struct _device {
43 	char		*d_node;
44 	char		*d_name;
45 	int		d_fd;
46 	uint_t		d_blksize;
47 	uchar_t		*d_inq;		/* INQUIRY response data */
48 	uint32_t	d_cap;		/* capabilities */
49 	int		(*d_read_audio)(struct _device *dev, uint_t start_blk,
50 			    uint_t nblks, uchar_t *buf);
51 	int		(*d_speed_ctrl)(struct _device *dev, int cmd,
52 			    int speed);
53 } cd_device;
54 
55 /* values for d_cap */
56 #define	DEV_CAP_EXTRACT_CDDA			1
57 #define	DEV_CAP_ACCURATE_CDDA			2
58 #define	DEV_CAP_SETTING_SPEED_NOT_ALLOWED	4
59 
60 /*
61  * Speed commands
62  */
63 #define	GET_READ_SPEED	1
64 #define	SET_READ_SPEED	2
65 #define	GET_WRITE_SPEED	3
66 #define	SET_WRITE_SPEED	4
67 
68 #define	SCAN_ALL_CDS		0x00	/* scan and return all cd devices */
69 #define	SCAN_WRITERS		0x01	/* select only writable devices */
70 #define	SCAN_LISTDEVS		0x02	/* print out device listing */
71 
72 #define	DVD_CONFIG_SIZE		0x20
73 
74 cd_device *get_device(char *user_supplied, char *node);
75 int lookup_device(char *supplied, char *found);
76 void fini_device(cd_device *dev);
77 int scan_for_cd_device(int mode, cd_device **found);
78 void write_next_track(int mode, bstreamhandle h);
79 int check_device(cd_device *dev, int cond);
80 void get_media_type(int fd);
81 void print_profile_list(int fd);
82 int ftr_supported(int fd, uint16_t feature);
83 uint_t cdrw_bandwidth_to_x(uint_t rate);
84 uint_t cdrw_x_to_bandwidth(uint_t x);
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif /* _DEVICE_H */
91