1/* 2 * Copyright (c) 2006-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 _IOBDMEDIABSDCLIENT_H 25#define _IOBDMEDIABSDCLIENT_H 26 27#include <sys/ioctl.h> 28#include <sys/types.h> 29 30#include <IOKit/storage/IOBDTypes.h> 31 32/* 33 * Definitions 34 * 35 * ioctl description 36 * ---------------------------- ------------------------------------------------ 37 * DKIOCBDREADSTRUCTURE see IOBDMedia::readStructure() in IOBDMedia.h 38 * 39 * DKIOCBDREADDISCINFO see IOBDMedia::readDiscInfo() in IOBDMedia.h 40 * DKIOCBDREADTRACKINFO see IOBDMedia::readTrackInfo() in IOBDMedia.h 41 * 42 * DKIOCBDREPORTKEY see IOBDMedia::reportKey() in IOBDMedia.h 43 * DKIOCBDSENDKEY see IOBDMedia::sendKey() in IOBDMedia.h 44 * 45 * DKIOCBDGETSPEED see IOBDMedia::getSpeed() in IOBDMedia.h 46 * DKIOCBDSETSPEED see IOBDMedia::setSpeed() in IOBDMedia.h 47 * 48 * in /System/Library/Frameworks/Kernel.framework/Headers/IOKit/storage/ 49 */ 50 51typedef struct 52{ 53 uint8_t format; 54 55 uint8_t reserved0008[3]; /* reserved, clear to zero */ 56 57 uint32_t address; 58 uint8_t grantID; 59 uint8_t layer; 60 61 uint8_t reserved0080[4]; /* reserved, clear to zero */ 62 63 uint16_t bufferLength; 64 void * buffer; 65} dk_bd_read_structure_t; 66 67typedef struct 68{ 69 uint8_t format; 70 uint8_t keyClass; 71 72 uint8_t reserved0016[2]; /* reserved, clear to zero */ 73 74 uint32_t address; 75 uint8_t grantID; 76 77 uint8_t reserved0072[5]; /* reserved, clear to zero */ 78 79 uint16_t bufferLength; 80 void * buffer; 81} dk_bd_report_key_t; 82 83typedef struct 84{ 85 uint8_t format; 86 uint8_t keyClass; 87 88 uint8_t reserved0016[6]; /* reserved, clear to zero */ 89 90 uint8_t grantID; 91 92 uint8_t reserved0072[5]; /* reserved, clear to zero */ 93 94 uint16_t bufferLength; 95 void * buffer; 96} dk_bd_send_key_t; 97 98typedef struct 99{ 100 uint8_t reserved0000[14]; /* reserved, clear to zero */ 101 102 uint16_t bufferLength; /* actual length on return */ 103 void * buffer; 104} dk_bd_read_disc_info_t; 105 106typedef struct 107{ 108 uint8_t reserved0000[4]; /* reserved, clear to zero */ 109 110 uint32_t address; 111 uint8_t addressType; 112 113 uint8_t reserved0072[5]; /* reserved, clear to zero */ 114 115 uint16_t bufferLength; /* actual length on return */ 116 void * buffer; 117} dk_bd_read_track_info_t; 118 119#define DKIOCBDREADSTRUCTURE _IOW('d', 160, dk_bd_read_structure_t) 120#define DKIOCBDREPORTKEY _IOW('d', 161, dk_bd_report_key_t) 121#define DKIOCBDSENDKEY _IOW('d', 162, dk_bd_send_key_t) 122 123#define DKIOCBDGETSPEED _IOR('d', 163, uint16_t) 124#define DKIOCBDSETSPEED _IOW('d', 163, uint16_t) 125 126#define DKIOCBDREADDISCINFO _IOWR('d', 164, dk_bd_read_disc_info_t) 127#define DKIOCBDREADTRACKINFO _IOWR('d', 165, dk_bd_read_track_info_t) 128 129#define DKIOCBDSPLITTRACK _IOW('d', 166, uint32_t) 130 131#ifdef KERNEL 132#ifdef __cplusplus 133 134/* 135 * Kernel 136 */ 137 138#include <IOKit/storage/IOBDMedia.h> 139#include <IOKit/storage/IOMediaBSDClient.h> 140 141/* 142 * Class 143 */ 144 145class IOBDMediaBSDClient : public IOMediaBSDClient 146{ 147 OSDeclareDefaultStructors(IOBDMediaBSDClient) 148 149protected: 150 151 struct ExpansionData { /* */ }; 152 ExpansionData * _expansionData; 153 154public: 155 156 /* 157 * Obtain this object's provider. We override the superclass's method 158 * to return a more specific subclass of IOService -- IOBDMedia. This 159 * method serves simply as a convenience to subclass developers. 160 */ 161 162 virtual IOBDMedia * getProvider() const; 163 164 /* 165 * Process a BD-specific ioctl. 166 */ 167 168 virtual int ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, proc_t proc); 169 170 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 0); 171 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 1); 172 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 2); 173 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 3); 174 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 4); 175 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 5); 176 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 6); 177 OSMetaClassDeclareReservedUnused(IOBDMediaBSDClient, 7); 178}; 179 180#endif /* __cplusplus */ 181#endif /* KERNEL */ 182#endif /* !_IOBDMEDIABSDCLIENT_H */ 183