Allow scsi_mmc_run_cmd to get called from outside.

This commit is contained in:
rocky
2004-07-23 14:40:43 +00:00
parent ead37407e7
commit 64febf9a8a
4 changed files with 83 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
/* Win32 aspi specific */ /* Win32 aspi specific */
/* /*
$Id: aspi32.h,v 1.9 2004/07/18 06:51:49 rocky Exp $ $Id: aspi32.h,v 1.10 2004/07/23 14:40:43 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -232,3 +232,24 @@ int read_mode2_sector_aspi (const _img_private_t *env, void *data, lsn_t lsn,
*/ */
bool read_toc_aspi (_img_private_t *env); bool read_toc_aspi (_img_private_t *env);
/*!
Run a SCSI MMC command.
env private CD structure
i_timeout time in milliseconds we will wait for the command
to complete. If this value is -1, use the default
time-out value.
p_buf Buffer for data, both sending and receiving
i_buf Size of buffer
e_direction direction the transfer is to go.
cdb CDB bytes. All values that are needed should be set on
input. We'll figure out what the right CDB length should be.
Return 0 if command completed successfully.
*/
int scsi_mmc_run_cmd_aspi( const void *p_user_data, int i_timeout,
unsigned int i_cdb,
const scsi_mmc_cdb_t * p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf );

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.c,v 1.26 2004/07/19 15:40:47 rocky Exp $ $Id: win32.c,v 1.27 2004/07/23 14:40:43 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32.c,v 1.26 2004/07/19 15:40:47 rocky Exp $"; static const char _rcsid[] = "$Id: win32.c,v 1.27 2004/07/23 14:40:43 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -124,6 +124,39 @@ _cdio_get_drive_cap (const void *env,
} }
} }
/*!
Run a SCSI MMC command.
env private CD structure
i_timeout time in milliseconds we will wait for the command
to complete. If this value is -1, use the default
time-out value.
p_buf Buffer for data, both sending and receiving
i_buf Size of buffer
e_direction direction the transfer is to go.
cdb CDB bytes. All values that are needed should be set on
input. We'll figure out what the right CDB length should be.
Return 0 if command completed successfully.
*/
static int
scsi_mmc_run_cmd_win32( const void *p_user_data, int i_timeout,
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf )
{
const _img_private_t *p_env = p_user_data;
if (p_env->hASPI) {
return scsi_mmc_run_cmd_aspi( p_env, i_timeout, i_cdb, p_cdb,
e_direction, i_buf, p_buf );
} else {
return scsi_mmc_run_cmd_win32ioctl( p_env, i_timeout, i_cdb, p_cdb,
e_direction, i_buf, p_buf );
}
}
/*! /*!
Initialize CD device. Initialize CD device.
*/ */
@@ -755,6 +788,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
.read_mode1_sectors = _cdio_read_mode1_sectors, .read_mode1_sectors = _cdio_read_mode1_sectors,
.read_mode2_sector = _cdio_read_mode2_sector, .read_mode2_sector = _cdio_read_mode2_sector,
.read_mode2_sectors = _cdio_read_mode2_sectors, .read_mode2_sectors = _cdio_read_mode2_sectors,
.run_scsi_mmc_cmd = scsi_mmc_run_cmd_win32,
.set_arg = _set_arg_win32, .set_arg = _set_arg_win32,
.stat_size = _cdio_stat_size .stat_size = _cdio_stat_size
}; };

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.h,v 1.13 2004/07/18 06:51:49 rocky Exp $ $Id: win32.h,v 1.14 2004/07/23 14:40:43 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -85,6 +85,27 @@ int read_mode1_sector_win32ioctl (const _img_private_t *env, void *data,
const char *is_cdrom_win32ioctl (const char drive_letter); const char *is_cdrom_win32ioctl (const char drive_letter);
/*!
Run a SCSI MMC command.
env private CD structure
i_timeout time in milliseconds we will wait for the command
to complete. If this value is -1, use the default
time-out value.
p_buf Buffer for data, both sending and receiving
i_buf Size of buffer
e_direction direction the transfer is to go.
cdb CDB bytes. All values that are needed should be set on
input. We'll figure out what the right CDB length should be.
Return 0 if command completed successfully.
*/
int scsi_mmc_run_cmd_win32ioctl( const void *p_user_data, int i_timeout,
unsigned int i_cdb,
const scsi_mmc_cdb_t * p_cdb,
scsi_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf );
/*! /*!
Initialize internal structures for CD device. Initialize internal structures for CD device.
*/ */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32_ioctl.c,v 1.21 2004/07/23 14:28:42 rocky Exp $ $Id: win32_ioctl.c,v 1.22 2004/07/23 14:40:43 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.21 2004/07/23 14:28:42 rocky Exp $"; static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.22 2004/07/23 14:40:43 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -142,7 +142,7 @@ typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
Return 0 if command completed successfully. Return 0 if command completed successfully.
*/ */
static int int
scsi_mmc_run_cmd_win32ioctl( const void *p_user_data, int i_timeout, scsi_mmc_run_cmd_win32ioctl( const void *p_user_data, int i_timeout,
unsigned int i_cdb, const scsi_mmc_cdb_t * p_cdb, unsigned int i_cdb, const scsi_mmc_cdb_t * p_cdb,
scsi_mmc_direction_t e_direction, scsi_mmc_direction_t e_direction,