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