1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer, 12 * without modification, immediately at the beginning of the file. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * $FreeBSD$ 31 */ 32 33 #ifndef _SYS_CDRIO_H_ 34 #define _SYS_CDRIO_H_ 35 36 #include <sys/ioccom.h> 37 38 struct cdr_track { 39 int datablock_type; /* data type code */ 40 #define CDR_DB_RAW 0x0 /* 2352 bytes of raw data */ 41 #define CDR_DB_RAW_PQ 0x1 /* 2368 bytes raw data + P/Q subchan */ 42 #define CDR_DB_RAW_PW 0x2 /* 2448 bytes raw data + P-W subchan */ 43 #define CDR_DB_RAW_PW_R 0x3 /* 2448 bytes raw data + P-W raw sub */ 44 #define CDR_DB_RES_4 0x4 /* reserved */ 45 #define CDR_DB_RES_5 0x5 /* reserved */ 46 #define CDR_DB_RES_6 0x6 /* reserved */ 47 #define CDR_DB_VS_7 0x7 /* vendor specific */ 48 #define CDR_DB_ROM_MODE1 0x8 /* 2048 bytes Mode 1 (ISO/IEC 10149) */ 49 #define CDR_DB_ROM_MODE2 0x9 /* 2336 bytes Mode 2 (ISO/IEC 10149) */ 50 #define CDR_DB_XA_MODE1 0xa /* 2048 bytes Mode 1 (CD-ROM XA 1) */ 51 #define CDR_DB_XA_MODE2_F1 0xb /* 2056 bytes Mode 2 (CD-ROM XA 1) */ 52 #define CDR_DB_XA_MODE2_F2 0xc /* 2324 bytes Mode 2 (CD-ROM XA 2) */ 53 #define CDR_DB_XA_MODE2_MIX 0xd /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */ 54 #define CDR_DB_RES_14 0xe /* reserved */ 55 #define CDR_DB_VS_15 0xf /* vendor specific */ 56 57 int preemp; /* preemphasis if audio track*/ 58 int test_write; /* use test writes, laser turned off */ 59 }; 60 61 struct cdr_cue_entry { 62 u_int8_t adr:4; 63 u_int8_t ctl:4; 64 u_int8_t track; 65 u_int8_t index; 66 u_int8_t dataform; 67 u_int8_t scms; 68 u_int8_t min; 69 u_int8_t sec; 70 u_int8_t frame; 71 }; 72 73 struct cdr_cuesheet { 74 int32_t len; 75 struct cdr_cue_entry *entries; 76 int session_format; 77 #define CDR_SESS_CDROM 0x00 78 #define CDR_SESS_CDI 0x10 79 #define CDR_SESS_CDROM_XA 0x20 80 81 int session_type; 82 #define CDR_SESS_NONE 0x00 83 #define CDR_SESS_FINAL 0x01 84 #define CDR_SESS_RESERVED 0x02 85 #define CDR_SESS_MULTI 0x03 86 87 int test_write; 88 }; 89 90 struct cdr_format_capacity { 91 u_int32_t blocks; 92 u_int32_t reserved:2; 93 u_int32_t type:6; 94 u_int32_t param:24; 95 }; 96 97 struct cdr_format_capacities { 98 u_int8_t reserved1[3]; 99 u_int8_t length; 100 u_int32_t blocks; 101 u_int32_t type:2; 102 u_int32_t reserved2:6; 103 u_int32_t block_size:24; 104 struct cdr_format_capacity format[32]; 105 }; 106 107 struct cdr_format_params { 108 u_int8_t reserved; 109 u_int8_t vs:1; 110 u_int8_t immed:1; 111 u_int8_t try_out:1; 112 u_int8_t ip:1; 113 u_int8_t stpf:1; 114 u_int8_t dcrt:1; 115 u_int8_t dpry:1; 116 u_int8_t fov:1; 117 u_int16_t length; 118 struct cdr_format_capacity format; 119 }; 120 121 #define CDRIOCBLANK _IOW('c', 100, int) 122 #define CDR_B_ALL 0x0 123 #define CDR_B_MIN 0x1 124 #define CDR_B_SESSION 0x6 125 126 #define CDRIOCNEXTWRITEABLEADDR _IOR('c', 101, int) 127 #define CDRIOCINITWRITER _IOW('c', 102, int) 128 #define CDRIOCINITTRACK _IOW('c', 103, struct cdr_track) 129 #define CDRIOCSENDCUE _IOW('c', 104, struct cdr_cuesheet) 130 #define CDRIOCFLUSH _IO('c', 105) 131 #define CDRIOCFIXATE _IOW('c', 106, int) 132 #define CDRIOCREADSPEED _IOW('c', 107, int) 133 #define CDRIOCWRITESPEED _IOW('c', 108, int) 134 #define CDR_MAX_SPEED 0xffff 135 #define CDRIOCGETBLOCKSIZE _IOR('c', 109, int) 136 #define CDRIOCSETBLOCKSIZE _IOW('c', 110, int) 137 #define CDRIOCGETPROGRESS _IOR('c', 111, int) 138 #define CDRIOCREADFORMATCAPS _IOR('c', 112, struct cdr_format_capacities) 139 #define CDRIOCFORMAT _IOW('c', 113, struct cdr_format_params) 140 141 #endif /* !_SYS_CDRIO_H_ */ 142