155522Ssos/*-
2230132Suqs * Copyright (c) 2000,2001,2002 S��ren Schmidt <sos@FreeBSD.org>
355522Ssos * All rights reserved.
455522Ssos *
555522Ssos * Redistribution and use in source and binary forms, with or without
655522Ssos * modification, are permitted provided that the following conditions
755522Ssos * are met:
855522Ssos * 1. Redistributions of source code must retain the above copyright
955522Ssos *    notice, this list of conditions and the following disclaimer,
1055522Ssos *    without modification, immediately at the beginning of the file.
1155522Ssos * 2. Redistributions in binary form must reproduce the above copyright
1255522Ssos *    notice, this list of conditions and the following disclaimer in the
1355522Ssos *    documentation and/or other materials provided with the distribution.
1455522Ssos * 3. The name of the author may not be used to endorse or promote products
1555522Ssos *    derived from this software without specific prior written permission.
1655522Ssos *
1755522Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1855522Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1955522Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2055522Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2155522Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2255522Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2355522Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2455522Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2555522Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2655522Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2755522Ssos *
2855522Ssos * $FreeBSD$
2955522Ssos */
3055522Ssos
3155522Ssos#ifndef	_SYS_CDRIO_H_
3255522Ssos#define	_SYS_CDRIO_H_
3355522Ssos
3455522Ssos#include <sys/ioccom.h>
3555522Ssos
3655522Ssosstruct cdr_track {
3770900Ssos        int datablock_type;         	/* data type code */
3855522Ssos#define CDR_DB_RAW              0x0     /* 2352 bytes of raw data */
3955522Ssos#define CDR_DB_RAW_PQ           0x1     /* 2368 bytes raw data + P/Q subchan */
4055522Ssos#define CDR_DB_RAW_PW           0x2     /* 2448 bytes raw data + P-W subchan */
4155522Ssos#define CDR_DB_RAW_PW_R         0x3     /* 2448 bytes raw data + P-W raw sub */
4255522Ssos#define CDR_DB_RES_4            0x4     /* reserved */
4355522Ssos#define CDR_DB_RES_5            0x5     /* reserved */
4455522Ssos#define CDR_DB_RES_6            0x6     /* reserved */
4555522Ssos#define CDR_DB_VS_7             0x7     /* vendor specific */
4655522Ssos#define CDR_DB_ROM_MODE1        0x8     /* 2048 bytes Mode 1 (ISO/IEC 10149) */
4755522Ssos#define CDR_DB_ROM_MODE2        0x9     /* 2336 bytes Mode 2 (ISO/IEC 10149) */
4855522Ssos#define CDR_DB_XA_MODE1         0xa     /* 2048 bytes Mode 1 (CD-ROM XA 1) */
4955522Ssos#define CDR_DB_XA_MODE2_F1      0xb     /* 2056 bytes Mode 2 (CD-ROM XA 1) */
5055522Ssos#define CDR_DB_XA_MODE2_F2      0xc     /* 2324 bytes Mode 2 (CD-ROM XA 2) */
5155522Ssos#define CDR_DB_XA_MODE2_MIX     0xd     /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */
5255522Ssos#define CDR_DB_RES_14           0xe     /* reserved */
5355522Ssos#define CDR_DB_VS_15            0xf     /* vendor specific */
5455522Ssos
5555522Ssos	int preemp;			/* preemphasis if audio track*/
5655522Ssos	int test_write;			/* use test writes, laser turned off */
5755522Ssos};
5855522Ssos
5983294Ssosstruct cdr_cue_entry {
6083294Ssos	u_int8_t adr:4;
6183294Ssos    	u_int8_t ctl:4;
6283294Ssos	u_int8_t track;
6383294Ssos	u_int8_t index;
6483294Ssos	u_int8_t dataform;
6583294Ssos	u_int8_t scms;
6683294Ssos	u_int8_t min;
6783294Ssos	u_int8_t sec;
6883294Ssos	u_int8_t frame;
6983294Ssos};
7083294Ssos
7183294Ssosstruct cdr_cuesheet {
7283294Ssos    	int32_t len;
7383294Ssos	struct cdr_cue_entry *entries;
7487371Ssos	int session_format;
7587371Ssos#define CDR_SESS_CDROM          0x00
7687371Ssos#define CDR_SESS_CDI            0x10
7787371Ssos#define CDR_SESS_CDROM_XA       0x20
7887371Ssos
7987371Ssos	int session_type;
8087371Ssos#define CDR_SESS_NONE           0x00
8187371Ssos#define CDR_SESS_FINAL          0x01
8287371Ssos#define CDR_SESS_RESERVED       0x02
8387371Ssos#define CDR_SESS_MULTI          0x03
8487371Ssos
8584300Ssos	int test_write;
8683294Ssos};
8783294Ssos
88101502Ssosstruct cdr_format_capacity {
89101502Ssos	u_int32_t blocks;
90101502Ssos	u_int32_t reserved:2;
91101502Ssos	u_int32_t type:6;
92101502Ssos	u_int32_t param:24;
93101502Ssos};
94101502Ssos
95101502Ssosstruct cdr_format_capacities {
96101502Ssos	u_int8_t reserved1[3];
97101502Ssos	u_int8_t length;
98101502Ssos	u_int32_t blocks;
99101502Ssos	u_int32_t type:2;
100101502Ssos	u_int32_t reserved2:6;
101101502Ssos	u_int32_t block_size:24;
102101502Ssos	struct cdr_format_capacity format[32];
103101502Ssos};
104101502Ssos
105101502Ssosstruct cdr_format_params {
106101502Ssos	u_int8_t reserved;
107101502Ssos	u_int8_t vs:1;
108101502Ssos	u_int8_t immed:1;
109101502Ssos	u_int8_t try_out:1;
110101502Ssos	u_int8_t ip:1;
111101502Ssos	u_int8_t stpf:1;
112101502Ssos	u_int8_t dcrt:1;
113101502Ssos	u_int8_t dpry:1;
114101502Ssos	u_int8_t fov:1;
115101502Ssos	u_int16_t length;
116101502Ssos	struct cdr_format_capacity format;
117101502Ssos};
118101502Ssos
11955522Ssos#define CDRIOCBLANK		_IOW('c', 100, int)
12070900Ssos#define CDR_B_ALL		0x0
12170900Ssos#define CDR_B_MIN		0x1
12270900Ssos#define CDR_B_SESSION		0x6
12370900Ssos
12455522Ssos#define CDRIOCNEXTWRITEABLEADDR	_IOR('c', 101, int)
12583294Ssos#define CDRIOCINITWRITER	_IOW('c', 102, int)
12683294Ssos#define CDRIOCINITTRACK		_IOW('c', 103, struct cdr_track)
12783294Ssos#define CDRIOCSENDCUE		_IOW('c', 104, struct cdr_cuesheet)
12883294Ssos#define CDRIOCFLUSH		_IO('c', 105)
12983294Ssos#define CDRIOCFIXATE		_IOW('c', 106, int)
13083294Ssos#define CDRIOCREADSPEED		_IOW('c', 107, int)
13183294Ssos#define CDRIOCWRITESPEED	_IOW('c', 108, int)
132105421Snjl#define CDR_MAX_SPEED		0xffff
13383294Ssos#define CDRIOCGETBLOCKSIZE	_IOR('c', 109, int)
13483294Ssos#define CDRIOCSETBLOCKSIZE	_IOW('c', 110, int)
13583294Ssos#define CDRIOCGETPROGRESS	_IOR('c', 111, int)
136101502Ssos#define CDRIOCREADFORMATCAPS	_IOR('c', 112, struct cdr_format_capacities)
137101502Ssos#define CDRIOCFORMAT		_IOW('c', 113, struct cdr_format_params)
13855522Ssos
13955522Ssos#endif /* !_SYS_CDRIO_H_ */
140