Preparing lowlevel cdrom rewrite
- use #if BX_SUPPORT_CDROM instead of #ifdef LOWLEVEL_CDROM - devices with cdrom support now use the base class cdrom_base_c - cdrom count variable moved to cdrom.cc - cdrom_misc.cc: don't use ioctl's for ISO files
This commit is contained in:
parent
9e43d90ce6
commit
b452803be5
@ -125,7 +125,7 @@ bx_hard_drive_c::bx_hard_drive_c()
|
||||
for (Bit8u channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
|
||||
for (Bit8u device=0; device<2; device ++) {
|
||||
channels[channel].drives[device].hdimage = NULL;
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
channels[channel].drives[device].cdrom.cd = NULL;
|
||||
#endif
|
||||
}
|
||||
@ -145,7 +145,7 @@ bx_hard_drive_c::~bx_hard_drive_c()
|
||||
delete channels[channel].drives[device].hdimage;
|
||||
channels[channel].drives[device].hdimage = NULL;
|
||||
}
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
if (channels[channel].drives[device].cdrom.cd != NULL) {
|
||||
delete channels[channel].drives[device].cdrom.cd;
|
||||
channels[channel].drives[device].cdrom.cd = NULL;
|
||||
@ -389,7 +389,7 @@ void bx_hard_drive_c::init(void)
|
||||
BX_CONTROLLER(channel,device).sector_count = 0;
|
||||
|
||||
// allocate low level driver
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.cd = DEV_hdimage_init_cdrom(SIM->get_param_string("path", base)->getptr());
|
||||
BX_INFO(("CD on ata%d-%d: '%s'",channel, device, SIM->get_param_string("path", base)->getptr()));
|
||||
|
||||
@ -863,7 +863,7 @@ Bit32u bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
case 0x28: // read (10)
|
||||
case 0xa8: // read (12)
|
||||
case 0xbe: // read cd
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
if (!BX_SELECTED_DRIVE(channel).cdrom.ready) {
|
||||
BX_PANIC(("Read with CDROM not ready"));
|
||||
}
|
||||
@ -887,7 +887,7 @@ Bit32u bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
// one block transfered, start at beginning
|
||||
index = 0;
|
||||
#else
|
||||
BX_PANIC(("Read with no LOWLEVEL_CDROM"));
|
||||
BX_PANIC(("READ: lowlevel cdrom support disabled"));
|
||||
#endif
|
||||
break;
|
||||
|
||||
@ -1270,7 +1270,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
atapi_cmd_nop(controller);
|
||||
raise_interrupt(channel);
|
||||
} else if (!LoEj && Start) { // start (spin up) the disc
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
BX_SELECTED_DRIVE(channel).cdrom.cd->start_cdrom();
|
||||
#endif
|
||||
BX_ERROR(("FIXME: ATAPI start disc not reading TOC"));
|
||||
@ -1280,7 +1280,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
atapi_cmd_nop(controller);
|
||||
|
||||
if (BX_SELECTED_DRIVE(channel).cdrom.ready) {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
BX_SELECTED_DRIVE(channel).cdrom.cd->eject_cdrom();
|
||||
#endif
|
||||
BX_SELECTED_DRIVE(channel).cdrom.ready = 0;
|
||||
@ -1589,7 +1589,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
|
||||
case 0x43: // read toc
|
||||
if (BX_SELECTED_DRIVE(channel).cdrom.ready) {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
bx_bool msf = (controller->buffer[1] >> 1) & 1;
|
||||
Bit8u starting_track = controller->buffer[6];
|
||||
int toc_length;
|
||||
@ -1598,7 +1598,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
Bit8u format = (controller->buffer[9] >> 6);
|
||||
// Win32: I just read the TOC using Win32's IOCTRL functions (Ben)
|
||||
#if defined(WIN32)
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
switch (format) {
|
||||
case 2:
|
||||
case 3:
|
||||
@ -1623,14 +1623,14 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
raise_interrupt(channel);
|
||||
}
|
||||
#else
|
||||
BX_PANIC(("LOWLEVEL_CDROM not defined"));
|
||||
BX_PANIC(("READ TOC: lowlevel cdrom support disabled"));
|
||||
#endif
|
||||
#else // WIN32
|
||||
switch (format) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
if (!(BX_SELECTED_DRIVE(channel).cdrom.cd->read_toc(controller->buffer,
|
||||
&toc_length, msf, starting_track, format))) {
|
||||
atapi_cmd_error(channel, SENSE_ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET, 1);
|
||||
@ -1640,7 +1640,7 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
ready_to_send_atapi(channel);
|
||||
}
|
||||
#else
|
||||
BX_PANIC(("LOWLEVEL_CDROM not defined"));
|
||||
BX_PANIC(("READ TOC: lowlevel cdrom support disabled"));
|
||||
#endif
|
||||
break;
|
||||
|
||||
@ -1728,10 +1728,10 @@ void bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
raise_interrupt(channel);
|
||||
break;
|
||||
}
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
BX_SELECTED_DRIVE(channel).cdrom.cd->seek(lba);
|
||||
#else
|
||||
BX_PANIC(("Seek with no LOWLEVEL_CDROM"));
|
||||
BX_PANIC(("SEEK: lowlevel cdrom support disabled"));
|
||||
#endif
|
||||
atapi_cmd_nop(controller);
|
||||
raise_interrupt(channel);
|
||||
@ -3177,7 +3177,7 @@ bx_bool bx_hard_drive_c::set_cd_media_status(Bit32u handle, bx_bool status)
|
||||
// eject cdrom if not locked by guest OS
|
||||
if (BX_HD_THIS channels[channel].drives[device].cdrom.locked) return(1);
|
||||
else {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.cd->eject_cdrom();
|
||||
#endif
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.ready = 0;
|
||||
@ -3185,7 +3185,7 @@ bx_bool bx_hard_drive_c::set_cd_media_status(Bit32u handle, bx_bool status)
|
||||
}
|
||||
} else {
|
||||
// insert cdrom
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
if (BX_HD_THIS channels[channel].drives[device].cdrom.cd->insert_cdrom(SIM->get_param_string("path", base)->getptr())) {
|
||||
BX_INFO(("Media present in CD-ROM drive"));
|
||||
BX_HD_THIS channels[channel].drives[device].cdrom.ready = 1;
|
||||
@ -3243,7 +3243,7 @@ bx_bool bx_hard_drive_c::bmdma_read_sector(Bit8u channel, Bit8u *buffer, Bit32u
|
||||
}
|
||||
/* set status bar conditions for device */
|
||||
bx_gui->statusbar_setitem(BX_SELECTED_DRIVE(channel).statusbar_id, 1);
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
if (!BX_SELECTED_DRIVE(channel).cdrom.cd->read_block(buffer, BX_SELECTED_DRIVE(channel).cdrom.next_lba,
|
||||
controller->buffer_size))
|
||||
{
|
||||
@ -3253,7 +3253,7 @@ bx_bool bx_hard_drive_c::bmdma_read_sector(Bit8u channel, Bit8u *buffer, Bit32u
|
||||
BX_SELECTED_DRIVE(channel).cdrom.next_lba++;
|
||||
BX_SELECTED_DRIVE(channel).cdrom.remaining_blocks--;
|
||||
#else
|
||||
BX_PANIC(("BM-DMA read with no LOWLEVEL_CDROM"));
|
||||
BX_PANIC(("BM-DMA read with lowlevel cdrom support disabled"));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2011 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -38,7 +38,9 @@ typedef enum _asc {
|
||||
} asc_t;
|
||||
|
||||
class device_image_t;
|
||||
class LOWLEVEL_CDROM;
|
||||
#if BX_SUPPORT_CDROM
|
||||
class cdrom_base_c;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
struct {
|
||||
@ -132,8 +134,8 @@ struct cdrom_t
|
||||
{
|
||||
bx_bool ready;
|
||||
bx_bool locked;
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
LOWLEVEL_CDROM* cd;
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom_base_c *cd;
|
||||
#endif
|
||||
Bit32u capacity;
|
||||
int next_lba;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2011 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -35,6 +35,8 @@
|
||||
|
||||
#define BX_CD_FRAMESIZE 2048
|
||||
|
||||
unsigned int bx_cdrom_count = 0;
|
||||
|
||||
bx_bool cdrom_interface::create_toc(Bit8u* buf, int* length, bx_bool msf, int start_track, int format)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <dos/dos.h>
|
||||
#endif
|
||||
|
||||
extern unsigned int bx_cdrom_count;
|
||||
|
||||
class cdrom_base_c : public logfunctions {
|
||||
public:
|
||||
virtual ~cdrom_base_c(void) {}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2011 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -110,13 +110,11 @@ extern "C" {
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static unsigned int cdrom_count = 0;
|
||||
|
||||
cdrom_interface::cdrom_interface(const char *dev)
|
||||
{
|
||||
char prefix[6];
|
||||
|
||||
sprintf(prefix, "CD%d", ++cdrom_count);
|
||||
sprintf(prefix, "CD%d", ++bx_cdrom_count);
|
||||
put(prefix);
|
||||
fd = -1; // File descriptor not yet allocated
|
||||
|
||||
@ -175,14 +173,16 @@ bx_bool cdrom_interface::start_cdrom()
|
||||
// Spin up the cdrom drive.
|
||||
|
||||
if (fd >= 0) {
|
||||
if (!using_file) {
|
||||
#if defined(__NetBSD__) || defined(__NetBSD_kernel__)
|
||||
if (ioctl (fd, CDIOCSTART) < 0)
|
||||
BX_DEBUG(("start_cdrom: start returns error: %s", strerror (errno)));
|
||||
return 1;
|
||||
if (ioctl (fd, CDIOCSTART) < 0)
|
||||
BX_DEBUG(("start_cdrom: start returns error: %s", strerror (errno)));
|
||||
return 1;
|
||||
#else
|
||||
BX_INFO(("start_cdrom: your OS is not supported yet"));
|
||||
return 0; // OS not supported yet, return 0 always
|
||||
BX_INFO(("start_cdrom: your OS is not supported yet"));
|
||||
return 0; // OS not supported yet, return 0 always
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -193,18 +193,15 @@ void cdrom_interface::eject_cdrom()
|
||||
// some ioctl() calls to really eject the CD as well.
|
||||
|
||||
if (fd >= 0) {
|
||||
if (!using_file) {
|
||||
#if (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
|
||||
(void) ioctl (fd, CDIOCALLOW);
|
||||
if (ioctl (fd, CDIOCEJECT) < 0)
|
||||
BX_DEBUG(("eject_cdrom: eject returns error"));
|
||||
#endif
|
||||
|
||||
|
||||
#if __linux__
|
||||
if (!using_file)
|
||||
(void) ioctl (fd, CDIOCALLOW);
|
||||
if (ioctl (fd, CDIOCEJECT) < 0)
|
||||
BX_ERROR(("eject_cdrom: eject returns error"));
|
||||
#elif defined(__linux__)
|
||||
ioctl (fd, CDROMEJECT, NULL);
|
||||
#endif
|
||||
|
||||
}
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2011 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -278,13 +278,11 @@ Exit:
|
||||
}
|
||||
|
||||
|
||||
static unsigned int cdrom_count = 0;
|
||||
|
||||
cdrom_interface::cdrom_interface(const char *dev)
|
||||
{
|
||||
char prefix[6];
|
||||
|
||||
sprintf(prefix, "CD%d", ++cdrom_count);
|
||||
sprintf(prefix, "CD%d", ++bx_cdrom_count);
|
||||
put(prefix);
|
||||
fd = -1; // File descriptor not yet allocated
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2011 The Bochs Project
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -99,14 +99,12 @@ typedef struct _CDROM_TOC_SESSION_DATA {
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static unsigned int cdrom_count = 0;
|
||||
|
||||
cdrom_interface::cdrom_interface(const char *dev)
|
||||
{
|
||||
char prefix[6];
|
||||
OSVERSIONINFO osinfo;
|
||||
|
||||
sprintf(prefix, "CD%d", ++cdrom_count);
|
||||
sprintf(prefix, "CD%d", ++bx_cdrom_count);
|
||||
put(prefix);
|
||||
fd = -1; // File descriptor not yet allocated
|
||||
|
||||
|
@ -140,8 +140,8 @@ device_image_t* bx_hdimage_ctl_c::init_image(Bit8u image_mode, Bit64u disk_size,
|
||||
return hdimage;
|
||||
}
|
||||
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
LOWLEVEL_CDROM* bx_hdimage_ctl_c::init_cdrom(const char *dev)
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom_base_c* bx_hdimage_ctl_c::init_cdrom(const char *dev)
|
||||
{
|
||||
return new LOWLEVEL_CDROM(dev);
|
||||
}
|
||||
|
@ -588,8 +588,8 @@ public:
|
||||
bx_hdimage_ctl_c();
|
||||
virtual ~bx_hdimage_ctl_c() {}
|
||||
virtual device_image_t *init_image(Bit8u image_mode, Bit64u disk_size, const char *journal);
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
virtual LOWLEVEL_CDROM* init_cdrom(const char *dev);
|
||||
#if BX_SUPPORT_CDROM
|
||||
virtual cdrom_base_c *init_cdrom(const char *dev);
|
||||
#endif
|
||||
};
|
||||
#endif // BXIMAGE
|
||||
|
@ -83,7 +83,7 @@ class BOCHSAPI bx_devmodel_c : public logfunctions {
|
||||
|
||||
class bx_list_c;
|
||||
class device_image_t;
|
||||
class LOWLEVEL_CDROM;
|
||||
class cdrom_base_c;
|
||||
|
||||
// the best should be deriving of bx_pci_device_stub_c from bx_devmodel_c
|
||||
// but it make serious problems for cirrus_svga device
|
||||
@ -338,8 +338,8 @@ public:
|
||||
virtual device_image_t* init_image(Bit8u image_mode, Bit64u disk_size, const char *journal) {
|
||||
STUBFUNC(hdimage_ctl, init_image); return NULL;
|
||||
}
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
virtual LOWLEVEL_CDROM* init_cdrom(const char *dev) {
|
||||
#if BX_SUPPORT_CDROM
|
||||
virtual cdrom_base_c* init_cdrom(const char *dev) {
|
||||
STUBFUNC(hdimage_ctl, init_cdrom); return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
//
|
||||
// Written by Paul Brook
|
||||
//
|
||||
// Copyright (C) 2007-2012 The Bochs Project
|
||||
// Copyright (C) 2007-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -49,7 +49,7 @@ scsi_device_t::scsi_device_t(device_image_t *_hdimage, int _tcq,
|
||||
scsi_completionfn _completion, void *_dev)
|
||||
{
|
||||
type = SCSIDEV_TYPE_DISK;
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom = NULL;
|
||||
#endif
|
||||
hdimage = _hdimage;
|
||||
@ -67,8 +67,8 @@ scsi_device_t::scsi_device_t(device_image_t *_hdimage, int _tcq,
|
||||
put("SCSID");
|
||||
}
|
||||
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
scsi_device_t::scsi_device_t(LOWLEVEL_CDROM *_cdrom, int _tcq,
|
||||
#if BX_SUPPORT_CDROM
|
||||
scsi_device_t::scsi_device_t(cdrom_base_c *_cdrom, int _tcq,
|
||||
scsi_completionfn _completion, void *_dev)
|
||||
{
|
||||
type = SCSIDEV_TYPE_CDROM;
|
||||
@ -239,7 +239,7 @@ void scsi_device_t::scsi_read_data(Bit32u tag)
|
||||
n = SCSI_DMA_BUF_SIZE / (512 * cluster_size);
|
||||
r->buf_len = n * 512 * cluster_size;
|
||||
if (type == SCSIDEV_TYPE_CDROM) {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
if (!cdrom->read_block(r->dma_buf, (Bit32u)r->sector, 2048)) {
|
||||
scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_HARDWARE_ERROR);
|
||||
} else {
|
||||
@ -637,7 +637,7 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun)
|
||||
if (type == SCSIDEV_TYPE_CDROM && (buf[4] & 2)) {
|
||||
if (!(buf[4] & 1)) {
|
||||
// eject medium
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom->eject_cdrom();
|
||||
#endif
|
||||
inserted = 0;
|
||||
@ -653,7 +653,7 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun)
|
||||
// The normal LEN field for this command is zero
|
||||
memset(outbuf, 0, 8);
|
||||
if (type == SCSIDEV_TYPE_CDROM) {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
nb_sectors = cdrom->capacity();
|
||||
#else
|
||||
nb_sectors = 0;
|
||||
@ -704,22 +704,22 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun)
|
||||
break;
|
||||
case 0x43:
|
||||
{
|
||||
int start_track, format, msf, toclen;
|
||||
int start_track, format, msf, toclen = 0;
|
||||
|
||||
if (type == SCSIDEV_TYPE_CDROM) {
|
||||
msf = buf[1] & 2;
|
||||
format = buf[2] & 0xf;
|
||||
start_track = buf[6];
|
||||
BX_DEBUG(("Read TOC (track %d format %d msf %d)", start_track, format, msf >> 1));
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom->read_toc(outbuf, &toclen, msf, start_track, format);
|
||||
#endif
|
||||
if (toclen > 0) {
|
||||
if (len > toclen)
|
||||
len = toclen;
|
||||
r->buf_len = len;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
BX_ERROR(("Read TOC error"));
|
||||
goto fail;
|
||||
} else {
|
||||
@ -770,7 +770,7 @@ Bit32s scsi_device_t::scsi_send_command(Bit32u tag, Bit8u *buf, int lun)
|
||||
|
||||
// Current/Max Cap Header
|
||||
if (type == SCSIDEV_TYPE_CDROM) {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
nb_sectors = cdrom->capacity();
|
||||
#else
|
||||
nb_sectors = 0;
|
||||
|
@ -9,7 +9,7 @@
|
||||
//
|
||||
// Written by Paul Brook
|
||||
//
|
||||
// Copyright (C) 2007-2012 The Bochs Project
|
||||
// Copyright (C) 2007-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -31,7 +31,7 @@
|
||||
typedef void (*scsi_completionfn)(void *opaque, int reason, Bit32u tag,
|
||||
Bit32u arg);
|
||||
class scsi_device_t;
|
||||
class LOWLEVEL_CDROM;
|
||||
class cdrom_base_c;
|
||||
|
||||
enum scsidev_type {
|
||||
SCSIDEV_TYPE_DISK,
|
||||
@ -70,8 +70,8 @@ class scsi_device_t : public logfunctions {
|
||||
public:
|
||||
scsi_device_t(device_image_t *_hdimage, int _tcq,
|
||||
scsi_completionfn _completion, void *_dev);
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
scsi_device_t(LOWLEVEL_CDROM *_cdrom, int _tcq,
|
||||
#if BX_SUPPORT_CDROM
|
||||
scsi_device_t(cdrom_base_c *_cdrom, int _tcq,
|
||||
scsi_completionfn _completion, void *_dev);
|
||||
#endif
|
||||
virtual ~scsi_device_t(void);
|
||||
@ -97,8 +97,8 @@ protected:
|
||||
private:
|
||||
enum scsidev_type type;
|
||||
device_image_t *hdimage;
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
LOWLEVEL_CDROM *cdrom;
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom_base_c *cdrom;
|
||||
#endif
|
||||
SCSIRequest *requests;
|
||||
int cluster_size;
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Copyright (c) 2006 CodeSourcery.
|
||||
// Written by Paul Brook
|
||||
// Copyright (C) 2009-2012 The Bochs Project
|
||||
// Copyright (C) 2009-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -132,7 +132,7 @@ static const Bit8u bx_msd_config_descriptor[] = {
|
||||
0x00 /* u8 ep_bInterval; */
|
||||
};
|
||||
|
||||
static int cdrom_count = 0;
|
||||
static int usb_cdrom_count = 0;
|
||||
|
||||
|
||||
usb_msd_device_c::usb_msd_device_c(usbdev_type type, const char *filename)
|
||||
@ -167,8 +167,8 @@ usb_msd_device_c::usb_msd_device_c(usbdev_type type, const char *filename)
|
||||
s.fname = filename;
|
||||
// config options
|
||||
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
|
||||
sprintf(pname, "cdrom%d", ++cdrom_count);
|
||||
sprintf(label, "USB CD-ROM #%d Configuration", cdrom_count);
|
||||
sprintf(pname, "cdrom%d", ++usb_cdrom_count);
|
||||
sprintf(label, "USB CD-ROM #%d Configuration", usb_cdrom_count);
|
||||
s.config = new bx_list_c(usb_rt, pname, label);
|
||||
s.config->set_options(bx_list_c::SERIES_ASK | bx_list_c::USE_BOX_TITLE);
|
||||
s.config->set_runtime_param(1);
|
||||
@ -202,7 +202,7 @@ usb_msd_device_c::~usb_msd_device_c(void)
|
||||
delete s.scsi_dev;
|
||||
if (s.hdimage != NULL) {
|
||||
delete s.hdimage;
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
} else if (s.cdrom != NULL) {
|
||||
delete s.cdrom;
|
||||
#if BX_WITH_WX
|
||||
@ -236,7 +236,7 @@ bx_bool usb_msd_device_c::init()
|
||||
}
|
||||
sprintf(s.info_txt, "USB HD: path='%s', mode='%s'", s.fname, hdimage_mode_names[s.image_mode]);
|
||||
} else if (d.type == USB_DEV_TYPE_CDROM) {
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
s.cdrom = DEV_hdimage_init_cdrom(s.fname);
|
||||
if (!s.cdrom->insert_cdrom()) {
|
||||
BX_ERROR(("could not open cdrom image file '%s'", s.fname));
|
||||
@ -246,7 +246,7 @@ bx_bool usb_msd_device_c::init()
|
||||
}
|
||||
sprintf(s.info_txt, "USB CD: path='%s'", s.fname);
|
||||
#else
|
||||
BX_PANIC(("missing LOWLEVEL_CDROM support"));
|
||||
BX_PANIC(("missing lowlevel cdrom support"));
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -661,7 +661,7 @@ void usb_msd_device_c::cancel_packet(USBPacket *p)
|
||||
|
||||
void usb_msd_device_c::set_inserted(bx_bool value)
|
||||
{
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
#if BX_SUPPORT_CDROM
|
||||
const char *path;
|
||||
|
||||
if (value) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Copyright (c) 2006 CodeSourcery.
|
||||
// Written by Paul Brook
|
||||
// Copyright (C) 2009-2012 The Bochs Project
|
||||
// Copyright (C) 2009-2013 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -27,7 +27,7 @@
|
||||
#define BX_IODEV_USB_MSD_H
|
||||
|
||||
class device_image_t;
|
||||
class LOWLEVEL_CDROM;
|
||||
class cdrom_base_c;
|
||||
class scsi_device_t;
|
||||
|
||||
class usb_msd_device_c : public usb_device_c {
|
||||
@ -66,8 +66,8 @@ private:
|
||||
int result;
|
||||
Bit8u image_mode;
|
||||
device_image_t *hdimage;
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
LOWLEVEL_CDROM *cdrom;
|
||||
#if BX_SUPPORT_CDROM
|
||||
cdrom_base_c *cdrom;
|
||||
#endif
|
||||
scsi_device_t *scsi_dev;
|
||||
USBPacket *packet;
|
||||
|
Loading…
Reference in New Issue
Block a user