filename | src/drivers/osx_iokit.h |
changeset | 720:b5594d1ac80a |
next | 729:4cc913eabd3d |
author | nkeynes |
date | Sat Jul 05 11:57:36 2008 +0000 (14 years ago) |
permissions | -rw-r--r-- |
last change | Get OS X cdrom driver to the 'sort of working' stage. Hide most of the IOKit fun in a separate osx_iokit module. |
file | annotate | diff | log | raw |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00001.2 +++ b/src/drivers/osx_iokit.h Sat Jul 05 11:57:36 2008 +00001.3 @@ -0,0 +1,80 @@1.4 +/**1.5 + * $Id: osx_iokit.h 687 2008-05-12 10:00:13Z nkeynes $1.6 + *1.7 + * General OS X IOKit support (primarily for cdrom support)1.8 + *1.9 + * Copyright (c) 2008 Nathan Keynes.1.10 + *1.11 + * This program is free software; you can redistribute it and/or modify1.12 + * it under the terms of the GNU General Public License as published by1.13 + * the Free Software Foundation; either version 2 of the License, or1.14 + * (at your option) any later version.1.15 + *1.16 + * This program is distributed in the hope that it will be useful,1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1.19 + * GNU General Public License for more details.1.20 + */1.21 +1.22 +#ifndef lxdream_osx_iokit_H1.23 +#define lxdream_osx_iokit_H 11.24 +1.25 +#include <IOKit/IOKitLib.h>1.26 +#include <IOKit/IOBSD.h>1.27 +#include <IOKit/storage/IOStorageDeviceCharacteristics.h>1.28 +#include <IOKit/storage/IOCDMediaBSDClient.h>1.29 +#include "lxdream.h"1.30 +#include "hook.h"1.31 +1.32 +/**1.33 + * CD-ROM drive visitor. Returns FALSE to continue iterating, TRUE if the desired CD-ROM1.34 + * has been found. In the latter case, the io_object is returned from find_cdrom_device1.35 + * (and not freed)1.36 + */1.37 +typedef gboolean (*find_drive_callback_t)( io_object_t object, char *vendor, char *product,1.38 + char *iopath, void *user_data );1.39 +1.40 +/**1.41 + * Search for a CD or DVD drive (instance of IODVDServices or IOCompactDiscServices).1.42 + * The callback will be called repeatedly until either it returns TRUE, or all drives1.43 + * have been iterated over.1.44 + *1.45 + * @return an IO registry entry for the matched drive, or 0 if no drives matched.1.46 + *1.47 + * Note: Use of IOCompactDiscServices is somewhat tentative since I don't have a Mac1.48 + * with a CD-Rom drive.1.49 + */1.50 +io_object_t find_cdrom_drive( find_drive_callback_t callback, void *user_data );1.51 +1.52 +typedef struct osx_cdrom_drive *osx_cdrom_drive_t;1.53 +1.54 +/**1.55 + * Construct an osx_cdrom_drive_t on the given device specification.1.56 + * @return a new osx_cdrom_drive_t, or NULL if the device name was invalid.1.57 + */1.58 +1.59 +osx_cdrom_drive_t osx_cdrom_open_drive( const char *devname );1.60 +1.61 +typedef void (*media_changed_callback_t)( osx_cdrom_drive_t drive, gboolean disc_present, void *user_data );1.62 +1.63 +/**1.64 + * Set the media changed callback for the drive. (NULL == no callback)1.65 + */1.66 +void osx_cdrom_set_media_changed_callback( osx_cdrom_drive_t drive,1.67 + media_changed_callback_t callback,1.68 + void *user_data );1.69 +1.70 +/**1.71 + * Return a file handle for the cdrom drive (actually for the media).1.72 + * @return an open file handle, or -1 if there was no media present or1.73 + * the media could not be opened.1.74 + */1.75 +int osx_cdrom_get_media_handle( osx_cdrom_drive_t drive );1.76 +1.77 +void osx_cdrom_release_media_handle( osx_cdrom_drive_t drive );1.78 +1.79 +/** Close on osx_cdrom_drive_t and release all associated resources.1.80 + */1.81 +void osx_cdrom_close_drive( osx_cdrom_drive_t drive );1.82 +1.83 +#endif /* !lxdream_osx_iokit_H */
.