cdrio.h revision 230132
11553Srgrimes/*-
21553Srgrimes * Copyright (c) 2000,2001,2002 S��ren Schmidt <sos@FreeBSD.org>
31553Srgrimes * All rights reserved.
41553Srgrimes *
51553Srgrimes * Redistribution and use in source and binary forms, with or without
61553Srgrimes * modification, are permitted provided that the following conditions
71553Srgrimes * are met:
81553Srgrimes * 1. Redistributions of source code must retain the above copyright
91553Srgrimes *    notice, this list of conditions and the following disclaimer,
101553Srgrimes *    without modification, immediately at the beginning of the file.
111553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
121553Srgrimes *    notice, this list of conditions and the following disclaimer in the
131553Srgrimes *    documentation and/or other materials provided with the distribution.
141553Srgrimes * 3. The name of the author may not be used to endorse or promote products
151553Srgrimes *    derived from this software without specific prior written permission.
161553Srgrimes *
171553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
181553Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
191553Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
201553Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
211553Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
221553Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231553Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241553Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251553Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
261553Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271553Srgrimes *
281553Srgrimes * $FreeBSD: head/sys/sys/cdrio.h 230132 2012-01-15 13:23:18Z uqs $
291553Srgrimes */
30114601Sobrien
311553Srgrimes#ifndef	_SYS_CDRIO_H_
3230643Scharnier#define	_SYS_CDRIO_H_
331553Srgrimes
341553Srgrimes#include <sys/ioccom.h>
351553Srgrimes
361553Srgrimesstruct cdr_track {
371553Srgrimes        int datablock_type;         	/* data type code */
381553Srgrimes#define CDR_DB_RAW              0x0     /* 2352 bytes of raw data */
39114601Sobrien#define CDR_DB_RAW_PQ           0x1     /* 2368 bytes raw data + P/Q subchan */
4030643Scharnier#define CDR_DB_RAW_PW           0x2     /* 2448 bytes raw data + P-W subchan */
41114601Sobrien#define CDR_DB_RAW_PW_R         0x3     /* 2448 bytes raw data + P-W raw sub */
42114601Sobrien#define CDR_DB_RES_4            0x4     /* reserved */
431553Srgrimes#define CDR_DB_RES_5            0x5     /* reserved */
441553Srgrimes#define CDR_DB_RES_6            0x6     /* reserved */
4514544Sdg#define CDR_DB_VS_7             0x7     /* vendor specific */
461553Srgrimes#define CDR_DB_ROM_MODE1        0x8     /* 2048 bytes Mode 1 (ISO/IEC 10149) */
471553Srgrimes#define CDR_DB_ROM_MODE2        0x9     /* 2336 bytes Mode 2 (ISO/IEC 10149) */
481553Srgrimes#define CDR_DB_XA_MODE1         0xa     /* 2048 bytes Mode 1 (CD-ROM XA 1) */
491553Srgrimes#define CDR_DB_XA_MODE2_F1      0xb     /* 2056 bytes Mode 2 (CD-ROM XA 1) */
501553Srgrimes#define CDR_DB_XA_MODE2_F2      0xc     /* 2324 bytes Mode 2 (CD-ROM XA 2) */
5120287Swollman#define CDR_DB_XA_MODE2_MIX     0xd     /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */
521553Srgrimes#define CDR_DB_RES_14           0xe     /* reserved */
531553Srgrimes#define CDR_DB_VS_15            0xf     /* vendor specific */
541553Srgrimes
551553Srgrimes	int preemp;			/* preemphasis if audio track*/
561553Srgrimes	int test_write;			/* use test writes, laser turned off */
571553Srgrimes};
581553Srgrimes
5955679Sshinstruct cdr_cue_entry {
6055679Sshin	u_int8_t adr:4;
6155679Sshin    	u_int8_t ctl:4;
621553Srgrimes	u_int8_t track;
631553Srgrimes	u_int8_t index;
641553Srgrimes	u_int8_t dataform;
651553Srgrimes	u_int8_t scms;
661553Srgrimes	u_int8_t min;
671553Srgrimes	u_int8_t sec;
681553Srgrimes	u_int8_t frame;
691553Srgrimes};
701553Srgrimes
711553Srgrimesstruct cdr_cuesheet {
721553Srgrimes    	int32_t len;
731553Srgrimes	struct cdr_cue_entry *entries;
741553Srgrimes	int session_format;
751553Srgrimes#define CDR_SESS_CDROM          0x00
7630643Scharnier#define CDR_SESS_CDI            0x10
771553Srgrimes#define CDR_SESS_CDROM_XA       0x20
781553Srgrimes
7930643Scharnier	int session_type;
8030643Scharnier#define CDR_SESS_NONE           0x00
81100114Salfred#define CDR_SESS_FINAL          0x01
8230643Scharnier#define CDR_SESS_RESERVED       0x02
831553Srgrimes#define CDR_SESS_MULTI          0x03
84100114Salfred
851553Srgrimes	int test_write;
861553Srgrimes};
871553Srgrimes
881553Srgrimesstruct cdr_format_capacity {
891553Srgrimes	u_int32_t blocks;
901553Srgrimes	u_int32_t reserved:2;
911553Srgrimes	u_int32_t type:6;
92100114Salfred	u_int32_t param:24;
93100114Salfred};
94100114Salfred
95100114Salfredstruct cdr_format_capacities {
96100114Salfred	u_int8_t reserved1[3];
9730643Scharnier	u_int8_t length;
9830643Scharnier	u_int32_t blocks;
99100114Salfred	u_int32_t type:2;
1001553Srgrimes	u_int32_t reserved2:6;
10130643Scharnier	u_int32_t block_size:24;
102100114Salfred	struct cdr_format_capacity format[32];
1031553Srgrimes};
104100114Salfred
105100114Salfredstruct cdr_format_params {
106100114Salfred	u_int8_t reserved;
1071553Srgrimes	u_int8_t vs:1;
10824428Simp	u_int8_t immed:1;
1091553Srgrimes	u_int8_t try_out:1;
1101553Srgrimes	u_int8_t ip:1;
1111553Srgrimes	u_int8_t stpf:1;
1121553Srgrimes	u_int8_t dcrt:1;
1131553Srgrimes	u_int8_t dpry:1;
1141553Srgrimes	u_int8_t fov:1;
1151553Srgrimes	u_int16_t length;
1161553Srgrimes	struct cdr_format_capacity format;
1171553Srgrimes};
1181553Srgrimes
1191553Srgrimes#define CDRIOCBLANK		_IOW('c', 100, int)
1201553Srgrimes#define CDR_B_ALL		0x0
12130643Scharnier#define CDR_B_MIN		0x1
12230643Scharnier#define CDR_B_SESSION		0x6
1231553Srgrimes
1241553Srgrimes#define CDRIOCNEXTWRITEABLEADDR	_IOR('c', 101, int)
1251553Srgrimes#define CDRIOCINITWRITER	_IOW('c', 102, int)
1261553Srgrimes#define CDRIOCINITTRACK		_IOW('c', 103, struct cdr_track)
1271553Srgrimes#define CDRIOCSENDCUE		_IOW('c', 104, struct cdr_cuesheet)
1281553Srgrimes#define CDRIOCFLUSH		_IO('c', 105)
1291553Srgrimes#define CDRIOCFIXATE		_IOW('c', 106, int)
1301553Srgrimes#define CDRIOCREADSPEED		_IOW('c', 107, int)
1311553Srgrimes#define CDRIOCWRITESPEED	_IOW('c', 108, int)
1321553Srgrimes#define CDR_MAX_SPEED		0xffff
13330643Scharnier#define CDRIOCGETBLOCKSIZE	_IOR('c', 109, int)
1341553Srgrimes#define CDRIOCSETBLOCKSIZE	_IOW('c', 110, int)
1351553Srgrimes#define CDRIOCGETPROGRESS	_IOR('c', 111, int)
1361553Srgrimes#define CDRIOCREADFORMATCAPS	_IOR('c', 112, struct cdr_format_capacities)
1371553Srgrimes#define CDRIOCFORMAT		_IOW('c', 113, struct cdr_format_params)
1381553Srgrimes
1391553Srgrimes#endif /* !_SYS_CDRIO_H_ */
140100114Salfred