1/* 2 * Copyright (c) 1998-2012 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef _IOCDMEDIABSDCLIENT_H 25#define _IOCDMEDIABSDCLIENT_H 26 27#include <sys/ioctl.h> 28 29#include <IOKit/storage/IOCDTypes.h> 30 31/* 32 * Definitions 33 * 34 * ioctl description 35 * ---------------------------- ------------------------------------------------ 36 * DKIOCCDREAD see IOCDMedia::readCD() in IOCDMedia.h 37 * DKIOCCDREADTOC see IOCDMedia::readTOC() in IOCDMedia.h 38 * 39 * DKIOCCDREADDISCINFO see IOCDMedia::readDiscInfo() in IOCDMedia.h 40 * DKIOCCDREADTRACKINFO see IOCDMedia::readTrackInfo() in IOCDMedia.h 41 * 42 * DKIOCCDREADISRC see IOCDMedia::readISRC() in IOCDMedia.h 43 * DKIOCCDREADMCN see IOCDMedia::readMCN() in IOCDMedia.h 44 * 45 * DKIOCCDGETSPEED see IOCDMedia::getSpeed() in IOCDMedia.h 46 * DKIOCCDSETSPEED see IOCDMedia::setSpeed() in IOCDMedia.h 47 * 48 * in /System/Library/Frameworks/Kernel.framework/Headers/IOKit/storage/ 49 */ 50 51typedef struct 52{ 53 uint64_t offset; 54 55 uint8_t sectorArea; 56 uint8_t sectorType; 57 58#ifdef __LP64__ 59 uint8_t reserved0080[10]; /* reserved, clear to zero */ 60#else /* !__LP64__ */ 61 uint8_t reserved0080[6]; /* reserved, clear to zero */ 62#endif /* !__LP64__ */ 63 64 uint32_t bufferLength; /* actual length on return */ 65 void * buffer; 66} dk_cd_read_t; 67 68typedef struct 69{ 70 CDISRC isrc; 71 uint8_t track; 72 73 uint8_t reserved0112[2]; /* reserved, clear to zero */ 74} dk_cd_read_isrc_t; 75 76typedef struct 77{ 78 CDMCN mcn; 79 80 uint8_t reserved0112[2]; /* reserved, clear to zero */ 81} dk_cd_read_mcn_t; 82 83typedef struct 84{ 85 uint8_t format; 86 uint8_t formatAsTime; 87 88 uint8_t reserved0016[5]; /* reserved, clear to zero */ 89 90 union 91 { 92 uint8_t session; 93 uint8_t track; 94 } address; 95 96#ifdef __LP64__ 97 uint8_t reserved0064[6]; /* reserved, clear to zero */ 98#else /* !__LP64__ */ 99 uint8_t reserved0064[2]; /* reserved, clear to zero */ 100#endif /* !__LP64__ */ 101 102 uint16_t bufferLength; /* actual length on return */ 103 void * buffer; 104} dk_cd_read_toc_t; 105 106typedef struct 107{ 108#ifdef __LP64__ 109 uint8_t reserved0000[14]; /* reserved, clear to zero */ 110#else /* !__LP64__ */ 111 uint8_t reserved0000[10]; /* reserved, clear to zero */ 112#endif /* !__LP64__ */ 113 114 uint16_t bufferLength; /* actual length on return */ 115 void * buffer; 116} dk_cd_read_disc_info_t; 117 118typedef struct 119{ 120 uint8_t reserved0000[4]; /* reserved, clear to zero */ 121 122 uint32_t address; 123 uint8_t addressType; 124 125#ifdef __LP64__ 126 uint8_t reserved0072[5]; /* reserved, clear to zero */ 127#else /* !__LP64__ */ 128 uint8_t reserved0072[1]; /* reserved, clear to zero */ 129#endif /* !__LP64__ */ 130 131 uint16_t bufferLength; /* actual length on return */ 132 void * buffer; 133} dk_cd_read_track_info_t; 134 135#define DKIOCCDREAD _IOWR('d', 96, dk_cd_read_t) 136 137#define DKIOCCDREADISRC _IOWR('d', 97, dk_cd_read_isrc_t) 138#define DKIOCCDREADMCN _IOWR('d', 98, dk_cd_read_mcn_t) 139 140#define DKIOCCDGETSPEED _IOR('d', 99, uint16_t) 141#define DKIOCCDSETSPEED _IOW('d', 99, uint16_t) 142 143#define DKIOCCDREADTOC _IOWR('d', 100, dk_cd_read_toc_t) 144 145#define DKIOCCDREADDISCINFO _IOWR('d', 101, dk_cd_read_disc_info_t) 146#define DKIOCCDREADTRACKINFO _IOWR('d', 102, dk_cd_read_track_info_t) 147 148#ifdef KERNEL 149#ifdef __cplusplus 150 151/* 152 * Kernel 153 */ 154 155#include <IOKit/storage/IOCDMedia.h> 156#include <IOKit/storage/IOMediaBSDClient.h> 157 158/* 159 * Class 160 */ 161 162class IOCDMediaBSDClient : public IOMediaBSDClient 163{ 164 OSDeclareDefaultStructors(IOCDMediaBSDClient) 165 166protected: 167 168 struct ExpansionData { /* */ }; 169 ExpansionData * _expansionData; 170 171public: 172 173 /* 174 * Obtain this object's provider. We override the superclass's method 175 * to return a more specific subclass of IOService -- IOCDMedia. This 176 * method serves simply as a convenience to subclass developers. 177 */ 178 179 virtual IOCDMedia * getProvider() const; 180 181 /* 182 * Process a CD-specific ioctl. 183 */ 184 185 virtual int ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, proc_t proc); 186 187 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 0); 188 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 1); 189 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 2); 190 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 3); 191 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 4); 192 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 5); 193 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 6); 194 OSMetaClassDeclareReservedUnused(IOCDMediaBSDClient, 7); 195}; 196 197#endif /* __cplusplus */ 198#endif /* KERNEL */ 199#endif /* !_IOCDMEDIABSDCLIENT_H */ 200