1 /* 2 NatFeat host CD-ROM access 3 Atari CD-ROM ioctls, structures and defines 4 5 ARAnyM (C) 2011 Patrice Mandin 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22 #ifndef NFCDROM_ATARI_H 23 #define NFCDROM_ATARI_H 24 25 /*--- Defines ---*/ 26 27 #define ENOTREADY -2 28 #define EINVFN -32 29 30 #define CDROM_LEADOUT_CDAR 0xa2 31 32 /* CD-ROM address types (cdrom_tocentry.cdte_format) */ 33 #define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ 34 #define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ 35 36 /* SUB Q control bits */ 37 38 #define CDROM_AUDIO_EMPHASIS 0x01 39 #define CDROM_COPY_PERMITTED 0x02 40 #define CDROM_DATA_TRACK 0x04 41 #define CDROM_FOUR_CHANNEL 0x08 42 43 /* audio states (from SCSI-2, but seen with other drives, too) */ 44 #define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ 45 #define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ 46 #define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ 47 #define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ 48 #define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ 49 #define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ 50 51 /*--- Types ---*/ 52 53 typedef struct { 54 unsigned char count; 55 unsigned char first; 56 } metados_bos_tracks_t; 57 58 typedef struct { 59 Uint32 next; /* (void *) for Atari */ 60 Uint32 attrib; 61 Uint16 phys_letter; 62 Uint16 dma_channel; 63 Uint16 sub_device; 64 Uint32 functions; /* (void *) for Atari */ 65 Uint16 status; 66 Uint32 reserved[2]; 67 Uint8 name[32]; 68 } metados_bos_header_t; 69 70 typedef struct { 71 unsigned char cdth_trk0; /* start track */ 72 unsigned char cdth_trk1; /* end track */ 73 } atari_cdromtochdr_t; 74 75 typedef struct 76 { 77 unsigned char cdmsf_min0; /* start minute */ 78 unsigned char cdmsf_sec0; /* start second */ 79 unsigned char cdmsf_frame0; /* start frame */ 80 unsigned char cdmsf_min1; /* end minute */ 81 unsigned char cdmsf_sec1; /* end second */ 82 unsigned char cdmsf_frame1; /* end frame */ 83 } atari_cdrom_msf_t; 84 85 typedef struct 86 { 87 unsigned char cdti_trk0; /* start track */ 88 unsigned char cdti_ind0; /* start index */ 89 unsigned char cdti_trk1; /* end track */ 90 unsigned char cdti_ind1; /* end index */ 91 } atari_cdrom_ti; 92 93 typedef struct { 94 /* input parameters */ 95 unsigned char cdte_track; /* track number or CDROM_LEADOUT */ 96 unsigned char cdte_format; /* CDROM_LBA or CDROM_MSF */ 97 98 /* output parameters */ 99 unsigned char cdte_info; 100 #if 0 101 unsigned cdte_adr:4; /* the SUBQ channel encodes 0: nothing, 102 1: position data, 2: MCN, 3: ISRC, 103 else: reserved */ 104 unsigned cdte_ctrl:4; /* bit 0: audio with pre-emphasis, 105 bit 1: digital copy permitted, 106 bit 2: data track, 107 bit 3: four channel */ 108 #endif 109 unsigned char cdte_datamode; /* currently not set */ 110 Uint16 dummy; /* PM: what is this for ? */ 111 Uint32 cdte_addr; /* track start */ 112 } atari_cdromtocentry_t; 113 114 typedef struct { /* TOC entry for MetaGetToc() function */ 115 unsigned char track; 116 unsigned char minute; 117 unsigned char second; 118 unsigned char frame; 119 } atari_tocentry_t; 120 121 typedef struct { /* Discinfo for MetaDiscInfo() function */ 122 unsigned char disctype, first, last, current; 123 atari_tocentry_t relative, absolute, end; 124 unsigned char index, reserved1[3]; 125 Uint32 reserved2[123]; 126 } atari_discinfo_t; 127 128 typedef struct { 129 /* input parameters */ 130 unsigned char cdsc_format; /* CDROM_MSF or CDROM_LBA */ 131 132 /* output parameters */ 133 unsigned char cdsc_audiostatus; /* see below */ 134 unsigned char cdsc_resvd; /* reserved */ 135 unsigned char cdsc_info; 136 #if 0 137 unsigned cdsc_adr: 4; /* in info field */ 138 unsigned cdsc_ctrl: 4; /* in info field */ 139 #endif 140 unsigned char cdsc_trk; /* current track */ 141 unsigned char cdsc_ind; /* current index */ 142 Uint32 cdsc_absaddr; /* absolute address */ 143 Uint32 cdsc_reladdr; /* track relative address */ 144 } atari_cdromsubchnl_t; 145 146 typedef struct { 147 /* input parameters */ 148 Uint16 set; /* 0 == inquire only */ 149 150 /* input/output parameters */ 151 struct { 152 unsigned char selection; 153 unsigned char volume; 154 } channel[4]; 155 } atari_cdrom_audioctrl_t; 156 157 struct atari_cdrom_volctrl 158 { 159 unsigned char channel0; /* volume level 0..255 */ 160 unsigned char channel1; 161 unsigned char channel2; 162 unsigned char channel3; 163 }; 164 165 typedef struct { 166 unsigned char audiostatus; 167 unsigned char mcn[23]; 168 } atari_mcn_t; 169 170 typedef struct { 171 Uint32 cdread_lba; /* logical block address */ 172 Uint32 cdread_bufaddr; /* (char *) buffer pointer */ 173 Uint32 cdread_buflen; /* byte count */ 174 } atari_cdrom_read_t; 175 176 typedef struct { 177 /* input parameters */ 178 Uint8 tisrc_track; /* track number */ 179 180 /* output parameters */ 181 182 Uint8 tisrc_audiostatus; /* see above */ 183 Uint8 tisrc_tisrc[23]; /* Track International Standard 184 Recording Code (ASCII) */ 185 } atari_tisrc_t; 186 187 /*--- Enums ---*/ 188 189 /* Atari ioctl */ 190 enum { 191 ATARI_CDROMREADOFFSET = (('C'<<8)|0x00), 192 ATARI_CDROMPAUSE, 193 ATARI_CDROMRESUME, 194 ATARI_CDROMPLAYMSF, 195 ATARI_CDROMPLAYTRKIND, 196 ATARI_CDROMREADTOCHDR, 197 ATARI_CDROMREADTOCENTRY, 198 ATARI_CDROMSTOP, 199 ATARI_CDROMSTART, 200 ATARI_CDROMEJECT, 201 ATARI_CDROMVOLCTRL, 202 ATARI_CDROMSUBCHNL, 203 ATARI_CDROMREADMODE2, 204 ATARI_CDROMREADMODE1, 205 ATARI_CDROMPREVENTREMOVAL, 206 ATARI_CDROMALLOWREMOVAL, 207 ATARI_CDROMAUDIOCTRL, 208 ATARI_CDROMREADDA, 209 ATARI_CDROMRESET, 210 ATARI_CDROMGETMCN, 211 ATARI_CDROMGETTISRC 212 }; 213 214 #endif /* NFCDROM_ATARI_H */ 215