1 /////////////////////////////////////////////////////////////////////////
2 // $Id: cdrom.h 14116 2021-01-31 15:44:39Z vruppert $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 //  Copyright (C) 2002-2021  The Bochs Project
6 //
7 //  This library is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU Lesser General Public
9 //  License as published by the Free Software Foundation; either
10 //  version 2 of the License, or (at your option) any later version.
11 //
12 //  This library is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //  Lesser General Public License for more details.
16 //
17 //  You should have received a copy of the GNU Lesser General Public
18 //  License along with this library; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20 
21 
22 // Header file for low-level OS specific CDROM emulation
23 
24 extern unsigned int bx_cdrom_count;
25 
26 
27 class cdrom_base_c : public logfunctions {
28 public:
cdrom_base_c()29   cdrom_base_c() {}
30   cdrom_base_c(const char *dev);
31   virtual ~cdrom_base_c(void);
32 
33   // Load CD-ROM. Returns 0 if CD is not ready.
34   virtual bool insert_cdrom(const char *dev = NULL);
35 
36   // Logically eject the CD.
37   virtual void eject_cdrom();
38 
39   // Read CD TOC. Returns 0 if start track is out of bounds.
40   virtual bool read_toc(Bit8u* buf, int* length, bool msf, int start_track, int format);
41 
42   // Return CD-ROM capacity (in 2048 byte frames)
43   virtual Bit32u capacity();
44 
45   // Read a single block from the CD. Returns 0 on failure.
46   virtual bool read_block(Bit8u* buf, Bit32u lba, int blocksize) BX_CPP_AttrRegparmN(3);
47 
48   // Start (spin up) the CD.
49   virtual bool start_cdrom();
50 
51   // Seek for new block address.
52   virtual bool seek(Bit32u lba);
53 
54 protected:
55   int fd;
56   char *path;
57   bool using_file;
58 };
59