xref: /titanic_52/usr/src/cmd/cdrw/device.h (revision e2529962e4cb04b49c12526895f0536d1d46daf6)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_DEVICE_H
27 #define	_DEVICE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/types.h>
36 
37 #include "bstream.h"
38 
39 #define	DEFAULT_CAPACITY	(74*60*75)
40 
41 typedef struct _device {
42 	char		*d_node;
43 	char		*d_name;
44 	int		d_fd;
45 	uint_t		d_blksize;
46 	uchar_t		*d_inq;		/* INQUIRY response data */
47 	uint32_t	d_cap;		/* capabilities */
48 	int		(*d_read_audio)(struct _device *dev, uint_t start_blk,
49 			    uint_t nblks, uchar_t *buf);
50 	int		(*d_speed_ctrl)(struct _device *dev, int cmd,
51 			    int speed);
52 } cd_device;
53 
54 /* values for d_cap */
55 #define	DEV_CAP_EXTRACT_CDDA			1
56 #define	DEV_CAP_ACCURATE_CDDA			2
57 #define	DEV_CAP_SETTING_SPEED_NOT_ALLOWED	4
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 void print_profile_list(int fd);
81 void print_profile_name(uint16_t num, uchar_t current, uchar_t abbr);
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