Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / icedax / mycdrom.h
1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12
13 /* @(#)mycdrom.h        1.10 06/05/07 Copyright 1998,1999 Heiko Eissfeldt, Copyright 2005-2006 J. Schilling */
14 #if defined(__linux__)
15 # include <linux/cdrom.h>
16 #else
17 # if defined HAVE_SYS_CDIO_H
18 #  include <sys/cdio.h>
19 #  if defined(__FreeBSD__) && __FreeBSD__ >= 2
20 #   include <osreldate.h>
21 #  endif
22 #  if defined HAVE_SYS_CDRIO_H  /* Was: if __FreeBSD_version >= 400014 */
23 #   include <sys/cdrio.h>
24 #  endif
25
26 #  if (defined (__sun) && defined (SVR4))
27 #   if 0
28 /* just for info */
29 /* Sun has this cdda reading ioctl: CDROMCDDA */
30 /*
31  * Definition of CD-DA structure
32  */
33 struct cdrom_cdda {
34  unsigned int cdda_addr;
35  unsigned int cdda_length;
36  caddr_t  cdda_data;
37  unsigned char cdda_subcode;
38 };
39 /*
40 To get the subcode information related to CD-DA data, the following values are
41  appropriate for the cdda_subcode field:
42
43 CDROM_DA_NO_SUBCODE
44 CD-DA data with no subcode.
45
46 CDROM_DA_SUBQ
47 CD-DA data with sub Q code.
48
49 CDROM_DA_ALL_SUBCODE
50 CD-DA data with all subcode.
51
52 CDROM_DA_SUBCODE_ONLY
53 All subcode only.
54
55 To allocate the memory related to CD-DA and/or subcode data, the following
56  values are appropriate for each data block transferred:
57
58 CD-DA data with no subcode
59 2352 bytes
60
61 CD-DA data with sub Q code
62 2368 bytes
63
64 CD-DA data with all subcode
65 2448 bytes
66
67 All subcode only
68 96 bytes
69 */
70
71 #   endif /* if 0 */
72 #  else /* not Sun SVR4 */
73 #   if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __DragonFly__  || defined __OpenBSD__
74 #    if (defined(__FreeBSD__) && __FreeBSD_version < 228000) || !defined(CDIOCREADAUDIO)
75         /*
76          * FreeBSD_version >= 501112 has no CDIOCREADAUDIO but uses pread()
77          */
78 #       if !(defined(__FreeBSD__) && __FreeBSD_version >= 501112)
79 #               undef HAVE_IOCTL_INTERFACE
80 #       endif
81 #    endif /* __FreeBSD_version < 228000 || !CDIOCREADAUDIO */
82
83 #ifdef  HAVE_IOCTL_INTERFACE
84
85 #define CDROM_LBA       CD_LBA_FORMAT
86 #define CDROM_MSF       CD_MSF_FORMAT
87 #define CDROM_DATA_TRACK        0x04
88 #define CDROM_LEADOUT   0xAA
89
90 #define CDROMSTOP       CDIOCSTOP
91 #define CDROMSTART      CDIOCSTART
92 #define CDROMREADTOCHDR CDIOREADTOCHEADER
93 #define CDROMREADTOCENTRY       CDIOREADTOCENTRY
94 #define CDROMPLAYMSF    CDIOCPLAYMSF
95 #define CDROMREADAUDIO  CDIOCREADAUDIO
96 #define CDROM_GET_MCN   CDIOCREADSUBCHANNEL
97 #define CDROMSUBCHNL    CDIOCREADSUBCHANNEL
98
99 #ifndef CDIOREADTOCENTRY
100 #define CDIOREADTOCENTRY        CDIOREADTOCENTRYS
101 #endif
102
103 #define cdrom_tochdr ioc_toc_header
104 #define cdth_trk0       starting_track
105 #define cdth_trk1       ending_track
106
107 #define cdrom_tocentry ioc_read_toc_single_entry
108 #define cdte_track      track
109 #define cdte_format     address_format
110 #define cdte_adr        entry.addr_type
111 #define cdte_ctrl       entry.control
112 #define cdte_addr       entry.addr
113
114 #define cdrom_read_audio ioc_read_audio
115 #define addr_format     address_format
116 #define buff            buffer
117
118 #define cdrom_msf       ioc_play_msf
119 #define cdmsf_min0      start_m
120 #define cdmsf_sec0      start_s
121 #define cdmsf_frame0    start_f
122 #define cdmsf_min1      end_m
123 #define cdmsf_sec1      end_s
124 #define cdmsf_frame1    end_f
125
126 #define cdrom_subchnl   ioc_read_subchannel
127 #define cdsc_audiostatus data->header.audio_status
128 #define cdsc_format     data->what.position.data_format
129 #define cdsc_adr        data->what.position.addr_type
130 #define cdsc_ctrl       data->what.position.control
131 #define cdsc_trk        data->what.position.track_number
132 #define cdsc_ind        data->what.position.index_number
133 #define cdsc_absaddr    data->what.position.absaddr
134 #define cdsc_reladdr    data->what.position.reladdr
135 #       endif   /* HAVE_IOCTL_INTERFACE */
136 #   else /* not *BSD */
137 #    undef HAVE_IOCTL_INTERFACE
138 #   endif /* not *BSD */
139 #  endif /* not SUN SVR4 */
140 # else /* HAVE_SYS_CDIO_H */
141 #  if defined HAVE_SUNDEV_SRREG_H
142 #   include <sundev/srreg.h>
143 #   if !defined CDROMCDDA
144 #    undef HAVE_IOCTL_INTERFACE
145 #   endif
146 #  else
147 #    undef HAVE_IOCTL_INTERFACE
148 #  endif
149 # endif /* not HAVE_SYS_CDIO_H */
150 #endif /* not linux */