2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-12-04 22:50:29 +03:00
|
|
|
// Copyright (C) 2002-2009 The Bochs Project
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
// Header file for low-level OS specific CDROM emulation
|
|
|
|
|
|
|
|
|
2011-07-17 21:23:12 +04:00
|
|
|
class cdrom_base_c : public logfunctions {
|
2001-04-10 05:04:59 +04:00
|
|
|
public:
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual ~cdrom_base_c(void) {}
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2005-12-27 16:21:25 +03:00
|
|
|
// Load CD-ROM. Returns 0 if CD is not ready.
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual bx_bool insert_cdrom(const char *dev = NULL) = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
// Logically eject the CD.
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual void eject_cdrom() = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2005-12-27 16:21:25 +03:00
|
|
|
// Read CD TOC. Returns 0 if start track is out of bounds.
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual bx_bool read_toc(Bit8u* buf, int* length, bx_bool msf, int start_track, int format) = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
// Return CD-ROM capacity (in 2048 byte frames)
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual Bit32u capacity() = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2005-12-27 16:21:25 +03:00
|
|
|
// Read a single block from the CD. Returns 0 on failure.
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual bx_bool read_block(Bit8u* buf, Bit32u lba, int blocksize) BX_CPP_AttrRegparmN(3) = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2003-08-19 04:37:03 +04:00
|
|
|
// Start (spin up) the CD.
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual bx_bool start_cdrom() = 0;
|
2003-08-19 04:37:03 +04:00
|
|
|
|
2005-12-27 16:21:25 +03:00
|
|
|
// Seek for new block address.
|
2011-07-17 21:23:12 +04:00
|
|
|
virtual void seek(Bit32u lba) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class cdrom_interface : public cdrom_base_c {
|
|
|
|
public:
|
|
|
|
cdrom_interface(const char *dev);
|
|
|
|
virtual ~cdrom_interface(void);
|
|
|
|
|
|
|
|
bx_bool insert_cdrom(const char *dev = NULL);
|
|
|
|
void eject_cdrom();
|
|
|
|
bx_bool read_toc(Bit8u* buf, int* length, bx_bool msf, int start_track, int format);
|
|
|
|
Bit32u capacity();
|
|
|
|
bx_bool read_block(Bit8u* buf, Bit32u lba, int blocksize) BX_CPP_AttrRegparmN(3);
|
|
|
|
bx_bool start_cdrom();
|
2009-04-21 19:37:17 +04:00
|
|
|
void seek(Bit32u lba);
|
2005-12-27 16:21:25 +03:00
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
private:
|
|
|
|
int fd;
|
|
|
|
char *path;
|
2001-06-19 01:11:46 +04:00
|
|
|
|
|
|
|
int using_file;
|
2002-10-03 15:59:37 +04:00
|
|
|
#ifdef WIN32
|
2004-08-22 20:23:35 +04:00
|
|
|
BOOL bUseASPI;
|
2002-10-03 15:59:37 +04:00
|
|
|
HANDLE hFile;
|
|
|
|
int hid;
|
|
|
|
int tid;
|
|
|
|
int lun;
|
|
|
|
#endif
|
2011-07-17 21:23:12 +04:00
|
|
|
};
|
2001-06-19 01:11:46 +04:00
|
|
|
|