1 /* @(#)mycdrom.h 1.15 13/06/01 Copyright 1998,1999 Heiko Eissfeldt, Copyright 2005-2013 J. Schilling */ 2 3 /* 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * See the file CDDL.Schily.txt in this distribution for details. 10 * A copy of the CDDL is also available via the Internet at 11 * http://www.opensource.org/licenses/cddl1.txt 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file CDDL.Schily.txt from this distribution. 15 */ 16 17 #if defined(__linux__) 18 # include <linux/cdrom.h> 19 #else 20 # if defined HAVE_SYS_CDIO_H 21 # include <sys/cdio.h> 22 /* 23 * Work around a bug in FreeBSD-9.1 24 * FreeBSD-9.1 has an incompatible #define __FreeBSD_kernel__ 25 * in sys/param.h that is in conflict with Debian k-FreeBSD. 26 */ 27 # ifdef __FreeBSD__ 28 # undef __FreeBSD_kernel__ 29 # define __FreeBSD_kernel__ 1 30 # endif 31 # if ((defined(__FreeBSD__) && (__FreeBSD__ >= 2)) || \ 32 (defined(__FreeBSD_kernel__) && (__FreeBSD_kernel__ > 2))) 33 # include <osreldate.h> 34 # endif 35 # if defined HAVE_SYS_CDRIO_H /* Was: if __FreeBSD_version >= 400014 */ 36 # include <sys/cdrio.h> 37 # endif 38 39 # if (defined(__sun) && defined(SVR4)) 40 # if 0 41 /* just for info */ 42 /* Sun has this cdda reading ioctl: CDROMCDDA */ 43 /* 44 * Definition of CD-DA structure 45 */ 46 struct cdrom_cdda { 47 unsigned int cdda_addr; 48 unsigned int cdda_length; 49 caddr_t cdda_data; 50 unsigned char cdda_subcode; 51 }; 52 53 /* 54 * To get the subcode information related to CD-DA data, the following values are 55 * appropriate for the cdda_subcode field: 56 * 57 * CDROM_DA_NO_SUBCODE 58 * CD-DA data with no subcode. 59 * 60 * CDROM_DA_SUBQ 61 * CD-DA data with sub Q code. 62 * 63 * CDROM_DA_ALL_SUBCODE 64 * CD-DA data with all subcode. 65 * 66 * CDROM_DA_SUBCODE_ONLY 67 * All subcode only. 68 * 69 * To allocate the memory related to CD-DA and/or subcode data, the following 70 * values are appropriate for each data block transferred: 71 * 72 * CD-DA data with no subcode 73 * 2352 bytes 74 * 75 * CD-DA data with sub Q code 76 * 2368 bytes 77 * 78 * CD-DA data with all subcode 79 * 2448 bytes 80 * 81 * All subcode only 82 * 96 bytes 83 */ 84 85 # endif /* if 0 */ 86 # else /* not Sun SVR4 */ 87 # if defined __FreeBSD__ || defined __FreeBSD_kernel__ || \ 88 defined __NetBSD__ || defined __OpenBSD__ || defined __DragonFly__ 89 # if ((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && \ 90 __FreeBSD_version < 228000) || !defined(CDIOCREADAUDIO) 91 /* 92 * FreeBSD_version >= 501112 has no CDIOCREADAUDIO but uses pread() 93 */ 94 # if !((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && \ 95 __FreeBSD_version >= 501112) 96 # undef HAVE_IOCTL_INTERFACE 97 # endif 98 # endif /* __FreeBSD_version < 228000 || !CDIOCREADAUDIO */ 99 100 #ifdef HAVE_IOCTL_INTERFACE 101 102 #define CDROM_LBA CD_LBA_FORMAT 103 #define CDROM_MSF CD_MSF_FORMAT 104 #define CDROM_DATA_TRACK 0x04 105 #define CDROM_LEADOUT 0xAA 106 107 #define CDROMSTOP CDIOCSTOP 108 #define CDROMSTART CDIOCSTART 109 #define CDROMREADTOCHDR CDIOREADTOCHEADER 110 #define CDROMREADTOCENTRY CDIOREADTOCENTRY 111 #define CDROMPLAYMSF CDIOCPLAYMSF 112 #define CDROMREADAUDIO CDIOCREADAUDIO 113 #define CDROM_GET_MCN CDIOCREADSUBCHANNEL 114 #define CDROMSUBCHNL CDIOCREADSUBCHANNEL 115 116 #ifndef CDIOREADTOCENTRY 117 #define CDIOREADTOCENTRY CDIOREADTOCENTRYS 118 #endif 119 120 #define cdrom_tochdr ioc_toc_header 121 #define cdth_trk0 starting_track 122 #define cdth_trk1 ending_track 123 124 #define cdrom_tocentry ioc_read_toc_single_entry 125 #define cdte_track track 126 #define cdte_format address_format 127 #define cdte_adr entry.addr_type 128 #define cdte_ctrl entry.control 129 #define cdte_addr entry.addr 130 131 #define cdrom_read_audio ioc_read_audio 132 #define addr_format address_format 133 #define buff buffer 134 135 #define cdrom_msf ioc_play_msf 136 #define cdmsf_min0 start_m 137 #define cdmsf_sec0 start_s 138 #define cdmsf_frame0 start_f 139 #define cdmsf_min1 end_m 140 #define cdmsf_sec1 end_s 141 #define cdmsf_frame1 end_f 142 143 #define cdrom_subchnl ioc_read_subchannel 144 #define cdsc_audiostatus data->header.audio_status 145 #define cdsc_format data->what.position.data_format 146 #define cdsc_adr data->what.position.addr_type 147 #define cdsc_ctrl data->what.position.control 148 #define cdsc_trk data->what.position.track_number 149 #define cdsc_ind data->what.position.index_number 150 #define cdsc_absaddr data->what.position.absaddr 151 #define cdsc_reladdr data->what.position.reladdr 152 # endif /* HAVE_IOCTL_INTERFACE */ 153 # else /* not *BSD */ 154 # undef HAVE_IOCTL_INTERFACE 155 # endif /* not *BSD */ 156 # endif /* not SUN SVR4 */ 157 # else /* HAVE_SYS_CDIO_H */ 158 # if defined HAVE_SUNDEV_SRREG_H 159 #define scsi_capacity __scsi_capacity__ 160 # include <sundev/srreg.h> 161 #undef scsi_capacity 162 # if !defined CDROMCDDA 163 # undef HAVE_IOCTL_INTERFACE 164 # endif 165 # else 166 # undef HAVE_IOCTL_INTERFACE 167 # endif 168 # endif /* not HAVE_SYS_CDIO_H */ 169 #endif /* not linux */ 170