1*ce099b40Smartin /* $NetBSD: linux_cdrom.h,v 1.8 2008/04/28 20:23:43 martin Exp $ */ 205d3f8a2Schristos 3908291d2Schristos /*- 4908291d2Schristos * Copyright (c) 1998 The NetBSD Foundation, Inc. 505d3f8a2Schristos * All rights reserved. 605d3f8a2Schristos * 7908291d2Schristos * This code is derived from software contributed to The NetBSD Foundation 8908291d2Schristos * by Eric Haszlakiewicz. 9908291d2Schristos * 1005d3f8a2Schristos * Redistribution and use in source and binary forms, with or without 1105d3f8a2Schristos * modification, are permitted provided that the following conditions 1205d3f8a2Schristos * are met: 1305d3f8a2Schristos * 1. Redistributions of source code must retain the above copyright 1405d3f8a2Schristos * notice, this list of conditions and the following disclaimer. 1505d3f8a2Schristos * 2. Redistributions in binary form must reproduce the above copyright 1605d3f8a2Schristos * notice, this list of conditions and the following disclaimer in the 1705d3f8a2Schristos * documentation and/or other materials provided with the distribution. 1805d3f8a2Schristos * 1905d3f8a2Schristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2005d3f8a2Schristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2105d3f8a2Schristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2205d3f8a2Schristos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2305d3f8a2Schristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2405d3f8a2Schristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2505d3f8a2Schristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2605d3f8a2Schristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2705d3f8a2Schristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2805d3f8a2Schristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2905d3f8a2Schristos * POSSIBILITY OF SUCH DAMAGE. 3005d3f8a2Schristos */ 3105d3f8a2Schristos 32908291d2Schristos #ifndef _LINUX_CDROM_H 33908291d2Schristos #define _LINUX_CDROM_H 34a20d9dceSerh 35a499e569Sfvdl #include <machine/endian.h> 36a499e569Sfvdl 3705d3f8a2Schristos #define LINUX_CDROMPAUSE 0x5301 3805d3f8a2Schristos #define LINUX_CDROMRESUME 0x5302 3905d3f8a2Schristos #define LINUX_CDROMPLAYMSF 0x5303 /* (struct linux_cdrom_msf) */ 4005d3f8a2Schristos #define LINUX_CDROMPLAYTRKIND 0x5304 /* (struct linux_cdrom_ti) */ 4105d3f8a2Schristos #define LINUX_CDROMREADTOCHDR 0x5305 /* (struct linux_cdrom_tochdr) */ 4205d3f8a2Schristos #define LINUX_CDROMREADTOCENTRY 0x5306 /* (struct linux_cdrom_tocentry) */ 4305d3f8a2Schristos #define LINUX_CDROMSTOP 0x5307 4405d3f8a2Schristos #define LINUX_CDROMSTART 0x5308 4505d3f8a2Schristos #define LINUX_CDROMEJECT 0x5309 4605d3f8a2Schristos #define LINUX_CDROMVOLCTRL 0x530a /* (struct linux_cdrom_volctrl) */ 4705d3f8a2Schristos #define LINUX_CDROMSUBCHNL 0x530b /* (struct linux_cdrom_subchnl) */ 4805d3f8a2Schristos #define LINUX_CDROMEJECT_SW 0x530f /* arg: 0 or 1 */ 49a499e569Sfvdl #define LINUX_CDROMMULTISESSION 0x5310 /* (struct linux_cdrom_multisession) */ 5005d3f8a2Schristos #define LINUX_CDROMRESET 0x5312 5105d3f8a2Schristos #define LINUX_CDROMVOLREAD 0x5313 /* (struct linux_cdrom_volctrl) */ 5205d3f8a2Schristos #define LINUX_CDROMPLAYBLK 0x5317 /* (struct linux_cdrom_blk) */ 53a499e569Sfvdl #define LINUX_CDROMCLOSETRAY 0x5319 /* */ 54a499e569Sfvdl #define LINUX_CDROM_SET_OPTIONS 0x5320 /* int */ 55a499e569Sfvdl #define LINUX_CDROM_CLEAR_OPTIONS 0x5321 /* int */ 56a499e569Sfvdl #define LINUX_CDROM_SELECT_SPEED 0x5322 57a499e569Sfvdl #define LINUX_CDROM_SELECT_DISC 0x5323 58a499e569Sfvdl #define LINUX_CDROM_MEDIA_CHANGED 0x5325 59a499e569Sfvdl #define LINUX_CDROM_DRIVE_STATUS 0x5326 60a499e569Sfvdl #define LINUX_CDROM_DISC_STATUS 0x5327 61a499e569Sfvdl #define LINUX_CDROM_CHANGER_NSLOTS 0x5328 62a499e569Sfvdl #define LINUX_CDROM_LOCKDOOR 0x5329 63a499e569Sfvdl #define LINUX_CDROM_DEBUG 0x5330 64a499e569Sfvdl #define LINUX_CDROM_GET_CAPABILITY 0x5331 6505d3f8a2Schristos 66e45ef6abSmycroft /* DVD-ROM Specific ioctls */ 67e45ef6abSmycroft #define LINUX_DVD_READ_STRUCT 0x5390 /* Read structure */ 68e45ef6abSmycroft #define LINUX_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 69e45ef6abSmycroft #define LINUX_DVD_AUTH 0x5392 /* Authentication */ 70e45ef6abSmycroft 7105d3f8a2Schristos struct linux_cdrom_blk { 7205d3f8a2Schristos unsigned from; 7305d3f8a2Schristos unsigned short len; 7405d3f8a2Schristos }; 7505d3f8a2Schristos 7605d3f8a2Schristos struct linux_cdrom_msf { 7705d3f8a2Schristos u_char cdmsf_min0; /* start minute */ 7805d3f8a2Schristos u_char cdmsf_sec0; /* start second */ 7905d3f8a2Schristos u_char cdmsf_frame0; /* start frame */ 8005d3f8a2Schristos u_char cdmsf_min1; /* end minute */ 8105d3f8a2Schristos u_char cdmsf_sec1; /* end second */ 8205d3f8a2Schristos u_char cdmsf_frame1; /* end frame */ 8305d3f8a2Schristos }; 8405d3f8a2Schristos 8505d3f8a2Schristos struct linux_cdrom_ti { 8605d3f8a2Schristos u_char cdti_trk0; /* start track */ 8705d3f8a2Schristos u_char cdti_ind0; /* start index */ 8805d3f8a2Schristos u_char cdti_trk1; /* end track */ 8905d3f8a2Schristos u_char cdti_ind1; /* end index */ 9005d3f8a2Schristos }; 9105d3f8a2Schristos 9205d3f8a2Schristos struct linux_cdrom_tochdr { 9305d3f8a2Schristos u_char cdth_trk0; /* start track */ 9405d3f8a2Schristos u_char cdth_trk1; /* end track */ 9505d3f8a2Schristos }; 9605d3f8a2Schristos 9705d3f8a2Schristos struct linux_cdrom_msf0 { 9805d3f8a2Schristos u_char minute; 9905d3f8a2Schristos u_char second; 10005d3f8a2Schristos u_char frame; 10105d3f8a2Schristos }; 10205d3f8a2Schristos 10305d3f8a2Schristos union linux_cdrom_addr { 10405d3f8a2Schristos struct linux_cdrom_msf0 msf; 10505d3f8a2Schristos int lba; 10605d3f8a2Schristos }; 10705d3f8a2Schristos 10805d3f8a2Schristos struct linux_cdrom_tocentry { 10905d3f8a2Schristos u_char cdte_track; 11005d3f8a2Schristos u_char cdte_adr :4; 11105d3f8a2Schristos u_char cdte_ctrl :4; 11205d3f8a2Schristos u_char cdte_format; 11305d3f8a2Schristos union linux_cdrom_addr cdte_addr; 11405d3f8a2Schristos u_char cdte_datamode; 11505d3f8a2Schristos }; 11605d3f8a2Schristos 11705d3f8a2Schristos struct linux_cdrom_subchnl { 11805d3f8a2Schristos u_char cdsc_format; 11905d3f8a2Schristos u_char cdsc_audiostatus; 12005d3f8a2Schristos u_char cdsc_adr: 4; 12105d3f8a2Schristos u_char cdsc_ctrl: 4; 12205d3f8a2Schristos u_char cdsc_trk; 12305d3f8a2Schristos u_char cdsc_ind; 12405d3f8a2Schristos union linux_cdrom_addr cdsc_absaddr; 12505d3f8a2Schristos union linux_cdrom_addr cdsc_reladdr; 12605d3f8a2Schristos }; 12705d3f8a2Schristos 12805d3f8a2Schristos struct linux_cdrom_volctrl { 12905d3f8a2Schristos u_char channel0; 13005d3f8a2Schristos u_char channel1; 13105d3f8a2Schristos u_char channel2; 13205d3f8a2Schristos u_char channel3; 13305d3f8a2Schristos }; 134a20d9dceSerh 135a499e569Sfvdl struct linux_cdrom_multisession { 136a499e569Sfvdl union linux_cdrom_addr addr; 137a499e569Sfvdl u_char xa_flag; 138a499e569Sfvdl u_char addr_format; 139a499e569Sfvdl }; 140a499e569Sfvdl 141a499e569Sfvdl struct linux_cdrom_mechstat_header { 142a499e569Sfvdl #if BYTE_ORDER == BIG_ENDIAN 143a499e569Sfvdl u_int8_t fault : 1; 144a499e569Sfvdl u_int8_t changer_state : 2; 145a499e569Sfvdl u_int8_t curslot : 5; 146a499e569Sfvdl u_int8_t mech_state : 3; 147a499e569Sfvdl u_int8_t door_open : 1; 148a499e569Sfvdl u_int8_t reserved1 : 4; 149a499e569Sfvdl #elif BYTE_ORDER == LITTLE_ENDIAN 150a499e569Sfvdl u_int8_t curslot : 5; 151a499e569Sfvdl u_int8_t changer_state : 2; 152a499e569Sfvdl u_int8_t fault : 1; 153a499e569Sfvdl u_int8_t reserved1 : 4; 154a499e569Sfvdl u_int8_t door_open : 1; 155a499e569Sfvdl u_int8_t mech_state : 3; 156a499e569Sfvdl #endif 157a499e569Sfvdl u_int8_t curlba[3]; 158a499e569Sfvdl u_int8_t nslots; 159a499e569Sfvdl u_int16_t slot_tablelen; 160a499e569Sfvdl }; 161a499e569Sfvdl 162a499e569Sfvdl struct linux_cdrom_slot { 163a499e569Sfvdl #if BYTE_ORDER == BIG_ENDIAN 164a499e569Sfvdl u_int8_t disc_present : 1; 165a499e569Sfvdl u_int8_t reserved1 : 6; 166a499e569Sfvdl u_int8_t change : 1; 167a499e569Sfvdl #elif BYTE_ORDER == LITTLE_ENDIAN 168a499e569Sfvdl u_int8_t change : 1; 169a499e569Sfvdl u_int8_t reserved1 : 6; 170a499e569Sfvdl u_int8_t disc_present : 1; 171a499e569Sfvdl #endif 172a499e569Sfvdl u_int8_t reserved2[3]; 173a499e569Sfvdl }; 174a499e569Sfvdl 175a499e569Sfvdl #define LINUX_CDROM_MAX_SLOTS 256 176a499e569Sfvdl 177a499e569Sfvdl struct linux_cdrom_changer_info { 178a499e569Sfvdl struct linux_cdrom_mechstat_header hdr; 179a499e569Sfvdl struct linux_cdrom_slot slots[LINUX_CDROM_MAX_SLOTS]; 180a499e569Sfvdl }; 181a499e569Sfvdl 182908291d2Schristos #endif /* !_LINUX_CDROM_H */ 183