Work on SCSI MMC layer. Some things may be broken.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* Common MMC routines.
|
||||
|
||||
$Id: scsi_mmc.c,v 1.6 2004/07/19 01:13:32 rocky Exp $
|
||||
$Id: scsi_mmc.c,v 1.7 2004/07/22 09:52:17 rocky Exp $
|
||||
|
||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
#include <cdio/scsi_mmc.h>
|
||||
#include "cdio_private.h"
|
||||
|
||||
/*!
|
||||
On input a MODE_SENSE command was issued and we have the results
|
||||
@@ -32,7 +33,7 @@
|
||||
capabilities.
|
||||
*/
|
||||
void
|
||||
cdio_get_drive_cap_mmc(const uint8_t *p,
|
||||
scsi_mmc_get_drive_cap(const uint8_t *p,
|
||||
/*out*/ cdio_drive_read_cap_t *p_read_cap,
|
||||
/*out*/ cdio_drive_write_cap_t *p_write_cap,
|
||||
/*out*/ cdio_drive_misc_cap_t *p_misc_cap)
|
||||
@@ -59,3 +60,43 @@ cdio_get_drive_cap_mmc(const uint8_t *p,
|
||||
if (p[6] >> 5 != 0)
|
||||
*p_misc_cap |= CDIO_DRIVE_CAP_MISC_CLOSE_TRAY;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the number of length in bytes of the Command Descriptor
|
||||
buffer (CDB) for a given SCSI MMC command. The length will be
|
||||
either 6, 10, or 12.
|
||||
*/
|
||||
uint8_t
|
||||
scsi_mmc_get_cmd_len(uint8_t scsi_cmd)
|
||||
{
|
||||
static const uint8_t scsi_cdblen[8] = {6, 10, 10, 12, 12, 12, 10, 10};
|
||||
return scsi_cdblen[((scsi_cmd >> 5) & 7)];
|
||||
}
|
||||
|
||||
/*!
|
||||
Run a SCSI MMC command.
|
||||
|
||||
cdio CD structure set by cdio_open().
|
||||
i_timeout time in milliseconds we will wait for the command
|
||||
to complete. If this value is -1, use the default
|
||||
time-out value.
|
||||
buf Buffer for data, both sending and receiving
|
||||
len 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.
|
||||
|
||||
We return 0 if command completed successfully and 1 if not.
|
||||
*/
|
||||
int
|
||||
scsi_mmc_run_cmd( const CdIo *cdio, int i_timeout, const scsi_mmc_cdb_t *p_cdb,
|
||||
scsi_mmc_direction_t e_direction, unsigned int i_buf,
|
||||
/*in/out*/ void *p_buf )
|
||||
{
|
||||
if (cdio && cdio->op.run_scsi_mmc_cmd) {
|
||||
return cdio->op.run_scsi_mmc_cmd(cdio, i_timeout,
|
||||
scsi_mmc_get_cmd_len(p_cdb->field[0]),
|
||||
p_cdb, e_direction, i_buf, p_buf);
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user