2003-09-14 09:36:32 +00:00
|
|
|
/*
|
2005-01-18 05:41:58 +00:00
|
|
|
$Id: scsi_mmc.h,v 1.39 2005/01/18 05:41:58 rocky Exp $
|
2003-09-14 09:36:32 +00:00
|
|
|
|
2005-01-05 04:16:11 +00:00
|
|
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
2003-09-14 09:36:32 +00:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
2004-06-26 01:08:46 +00:00
|
|
|
/*!
|
|
|
|
|
\file scsi_mmc.h
|
2004-07-22 09:52:17 +00:00
|
|
|
\brief Common definitions for SCSI MMC (Multi-Media Commands).
|
2003-09-14 09:36:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __SCSI_MMC_H__
|
|
|
|
|
#define __SCSI_MMC_H__
|
|
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
#include <cdio/cdio.h>
|
|
|
|
|
#include <cdio/types.h>
|
2004-07-26 03:58:25 +00:00
|
|
|
#include <cdio/dvd.h>
|
2004-07-22 09:52:17 +00:00
|
|
|
|
2004-04-24 19:18:52 +00:00
|
|
|
/*! The generic packet command opcodes for CD/DVD Logical Units. */
|
|
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_GPCMD_INQUIRY 0x12
|
|
|
|
|
#define CDIO_MMC_GPCMD_MODE_SELECT_6 0x15
|
2004-07-08 01:27:57 +00:00
|
|
|
#define CDIO_MMC_GPCMD_MODE_SENSE 0x1a
|
|
|
|
|
#define CDIO_MMC_GPCMD_START_STOP 0x1b
|
2004-07-19 01:13:31 +00:00
|
|
|
#define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL 0x1e
|
2004-07-08 01:27:57 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_10 0x28
|
2004-07-21 11:07:27 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Group 2 Commands
|
|
|
|
|
*/
|
2004-07-08 01:27:57 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_SUBCHANNEL 0x42
|
|
|
|
|
#define CDIO_MMC_GPCMD_READ_TOC 0x43
|
2004-07-21 11:07:27 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_HEADER 0x44
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_GPCMD_PLAY_AUDIO_10 0x45
|
2004-08-01 11:29:13 +00:00
|
|
|
#define CDIO_MMC_GPCMD_GET_CONFIGURATION 0x46
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_GPCMD_PLAY_AUDIO_MSF 0x47
|
|
|
|
|
#define CDIO_MMC_GPCMD_PLAY_AUDIO_TI 0x48
|
2004-07-23 11:29:49 +00:00
|
|
|
#define CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 0x49
|
2004-07-21 11:07:27 +00:00
|
|
|
#define CDIO_MMC_GPCMD_PAUSE_RESUME 0x4b
|
|
|
|
|
|
2004-07-21 10:19:20 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_DISC_INFO 0x51
|
2004-07-08 01:27:57 +00:00
|
|
|
#define CDIO_MMC_GPCMD_MODE_SELECT 0x55
|
|
|
|
|
#define CDIO_MMC_GPCMD_MODE_SENSE_10 0x5a
|
2004-07-21 11:07:27 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Group 5 Commands
|
|
|
|
|
*/
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_GPCMD_PLAY_AUDIO_12 0xa5
|
2004-07-08 01:27:57 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_12 0xa8
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 0xa9
|
2004-07-25 16:38:05 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_DVD_STRUCTURE 0xad
|
2004-07-08 01:27:57 +00:00
|
|
|
#define CDIO_MMC_GPCMD_READ_CD 0xbe
|
|
|
|
|
#define CDIO_MMC_GPCMD_READ_MSF 0xb9
|
2003-09-19 04:36:41 +00:00
|
|
|
|
2004-07-21 11:07:27 +00:00
|
|
|
/*!
|
|
|
|
|
Group 6 Commands
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS 0xc4 /**< SONY unique command */
|
|
|
|
|
#define CDIO_MMC_GPCMD_PLAYBACK_CONTROL 0xc9 /**< SONY unique command */
|
|
|
|
|
#define CDIO_MMC_GPCMD_READ_CDDA 0xd8 /**< Vendor unique command */
|
|
|
|
|
#define CDIO_MMC_GPCMD_READ_CDXA 0xdb /**< Vendor unique command */
|
|
|
|
|
#define CDIO_MMC_GPCMD_READ_ALL_SUBCODES 0xdf /**< Vendor unique command */
|
|
|
|
|
|
|
|
|
|
|
2004-06-27 22:00:08 +00:00
|
|
|
|
2004-07-21 10:19:20 +00:00
|
|
|
/*! Level values that can go into READ_CD */
|
|
|
|
|
#define CDIO_MMC_READ_TYPE_ANY 0 /**< All types */
|
|
|
|
|
#define CDIO_MMC_READ_TYPE_CDDA 1 /**< Only CD-DA sectors */
|
|
|
|
|
#define CDIO_MMC_READ_TYPE_MODE1 2 /**< mode1 sectors (user data = 2048) */
|
|
|
|
|
#define CDIO_MMC_READ_TYPE_MODE2 3 /**< mode2 sectors form1 or form2 */
|
|
|
|
|
#define CDIO_MMC_READ_TYPE_M2F1 4 /**< mode2 sectors form1 */
|
|
|
|
|
#define CDIO_MMC_READ_TYPE_M2F2 5 /**< mode2 sectors form2 */
|
|
|
|
|
|
|
|
|
|
/*! Format values for READ_TOC */
|
|
|
|
|
#define CDIO_MMC_READTOC_FMT_TOC 0
|
|
|
|
|
#define CDIO_MMC_READTOC_FMT_SESSION 1
|
|
|
|
|
#define CDIO_MMC_READTOC_FMT_FULTOC 2
|
|
|
|
|
#define CDIO_MMC_READTOC_FMT_PMA 3 /**< Q subcode data */
|
|
|
|
|
#define CDIO_MMC_READTOC_FMT_ATIP 4 /**< includes media type */
|
|
|
|
|
#define CDIO_MMC_READTOC_FMT_CDTEXT 5 /**< CD-TEXT info */
|
|
|
|
|
|
2004-06-27 22:00:08 +00:00
|
|
|
/*! Page codes for MODE SENSE and MODE SET. */
|
|
|
|
|
#define CDIO_MMC_R_W_ERROR_PAGE 0x01
|
|
|
|
|
#define CDIO_MMC_WRITE_PARMS_PAGE 0x05
|
|
|
|
|
#define CDIO_MMC_AUDIO_CTL_PAGE 0x0e
|
2004-07-08 06:29:45 +00:00
|
|
|
#define CDIO_MMC_CDR_PARMS_PAGE 0x0d
|
2004-06-27 22:00:08 +00:00
|
|
|
#define CDIO_MMC_POWER_PAGE 0x1a
|
|
|
|
|
#define CDIO_MMC_FAULT_FAIL_PAGE 0x1c
|
|
|
|
|
#define CDIO_MMC_TO_PROTECT_PAGE 0x1d
|
|
|
|
|
#define CDIO_MMC_CAPABILITIES_PAGE 0x2a
|
|
|
|
|
#define CDIO_MMC_ALL_PAGES 0x3f
|
|
|
|
|
|
2004-08-06 11:55:16 +00:00
|
|
|
/*! Return type codes for GET_CONFIGURATION. */
|
|
|
|
|
#define CDIO_MMC_GET_CONF_ALL_FEATURES 0 /**< all features without regard
|
|
|
|
|
to currency. */
|
|
|
|
|
#define CDIO_MMC_GET_CONF_CURRENT_FEATURES 1 /**< features which are currently
|
|
|
|
|
in effect (e.g. based on
|
|
|
|
|
medium inserted). */
|
|
|
|
|
#define CDIO_MMC_GET_CONF_NAMED_FEATURE 2 /**< just the feature named in
|
|
|
|
|
the GET_CONFIGURATION
|
|
|
|
|
cdb. */
|
|
|
|
|
|
2004-08-06 22:08:07 +00:00
|
|
|
/*! FEATURE codes used in GET CONFIGURATION. */
|
|
|
|
|
|
2004-08-07 01:48:36 +00:00
|
|
|
#define CDIO_MMC_FEATURE_PROFILE_LIST 0x000 /**< Profile List Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_CORE 0x001
|
|
|
|
|
#define CDIO_MMC_FEATURE_REMOVABLE_MEDIUM 0x002 /**< Removable Medium
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_WRITE_PROTECT 0x003 /**< Write Protect
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_RANDOM_READABLE 0x010 /**< Random Readable
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_MULTI_READ 0x01D /**< Multi-Read
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_CD_READ 0x01E /**< CD Read
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_DVD_READ 0x01F /**< DVD Read
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_RANDOM_WRITABLE 0x020 /**< Random Writable
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_INCR_WRITE 0x021 /**< Incremental
|
|
|
|
|
Streaming Writable
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_SECTOR_ERASE 0x022 /**< Sector Erasable
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_FORMATABLE 0x023 /**< Formattable
|
|
|
|
|
Feature */
|
2004-08-10 02:29:46 +00:00
|
|
|
#define CDIO_MMC_FEATURE_DEFECT_MGMT 0x024 /**< Management
|
|
|
|
|
Ability of the
|
|
|
|
|
Logical Unit/media
|
|
|
|
|
system to provide
|
|
|
|
|
an apparently
|
|
|
|
|
defect-free
|
|
|
|
|
space.*/
|
2004-08-07 01:48:36 +00:00
|
|
|
#define CDIO_MMC_FEATURE_WRITE_ONCE 0x025 /**< Write Once
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_RESTRICT_OVERW 0x026 /**< Restricted
|
|
|
|
|
Overwrite
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_CD_RW_CAV 0x027 /**< CD-RW CAV Write
|
|
|
|
|
Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_MRW 0x028 /**< MRW Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_DVD_PRW 0x02A /**< DVD+RW Feature */
|
|
|
|
|
#define CDIO_MMC_FEATURE_DVD_PR 0x02B /**< DVD+R Feature */
|
2004-08-06 22:08:07 +00:00
|
|
|
#define CDIO_MMC_FEATURE_CD_TAO 0x02D
|
|
|
|
|
#define CDIO_MMC_FEATURE_CD_SAO 0x02E
|
2004-08-07 03:25:25 +00:00
|
|
|
#define CDIO_MMC_FEATURE_POWER_MGMT 0x100 /**< Initiator and
|
|
|
|
|
device directed
|
|
|
|
|
power management */
|
|
|
|
|
#define CDIO_MMC_FEATURE_CDDA_EXT_PLAY 0x103 /**< Ability to play
|
|
|
|
|
audio CDs via the
|
|
|
|
|
Logical Unit s own
|
|
|
|
|
analog output */
|
|
|
|
|
#define CDIO_MMC_FEATURE_MCODE_UPGRADE 0x104 /* Ability for the
|
|
|
|
|
device to accept
|
|
|
|
|
new microcode via
|
|
|
|
|
the interface */
|
|
|
|
|
#define CDIO_MMC_FEATURE_TIME_OUT 0x105 /**< Ability to
|
|
|
|
|
respond to all
|
|
|
|
|
commands within a
|
|
|
|
|
specific time */
|
|
|
|
|
#define CDIO_MMC_FEATURE_DVD_CSS 0x106 /**< Ability to
|
|
|
|
|
perform DVD
|
|
|
|
|
CSS/CPPM
|
|
|
|
|
authentication and
|
|
|
|
|
RPC */
|
2004-08-10 02:29:46 +00:00
|
|
|
#define CDIO_MMC_FEATURE_RT_STREAMING 0x107 /**< Ability to read
|
|
|
|
|
and write using
|
|
|
|
|
Initiator requested
|
|
|
|
|
performance
|
|
|
|
|
parameters
|
|
|
|
|
*/
|
2004-08-07 03:25:25 +00:00
|
|
|
#define CDIO_MMC_FEATURE_LU_SN 0x108 /**< The Logical Unit
|
|
|
|
|
has a unique
|
|
|
|
|
identifier. */
|
|
|
|
|
#define CDIO_MMC_FEATURE_FIRMWARE_DATE 0x1FF /**< Firmware creation
|
|
|
|
|
date report */
|
2004-08-06 11:55:16 +00:00
|
|
|
|
2004-08-06 22:08:07 +00:00
|
|
|
/*! Profile codes used in GET_CONFIGURATION - PROFILE LIST. */
|
2004-08-07 01:48:36 +00:00
|
|
|
#define CDIO_MMC_FEATURE_PROF_NON_REMOVABLE 0x0001 /**< Re-writable
|
|
|
|
|
disk, capable of
|
|
|
|
|
changing
|
|
|
|
|
behavior */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_REMOVABLE 0x0002 /**< disk
|
|
|
|
|
Re-writable;
|
|
|
|
|
with removable
|
|
|
|
|
media */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_MO_ERASABLE 0x0003 /**< Erasable
|
|
|
|
|
Magneto-Optical
|
|
|
|
|
disk with sector
|
|
|
|
|
erase
|
|
|
|
|
capability */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE 0x0004 /**< Write Once
|
|
|
|
|
Magneto-Optical
|
|
|
|
|
write once */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_AS_MO 0x0005 /**< Advance
|
|
|
|
|
Storage
|
|
|
|
|
Magneto-Optical */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_CD_ROM 0x0008 /**< Read only
|
|
|
|
|
Compact Disc
|
|
|
|
|
capable */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_CD_R 0x0009 /**< Write once
|
|
|
|
|
Compact Disc
|
|
|
|
|
capable */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_CD_RW 0x000A /**< CD-RW
|
|
|
|
|
Re-writable
|
|
|
|
|
Compact Disc
|
|
|
|
|
capable */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_ROM 0x0010 /**< Read only
|
|
|
|
|
DVD */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_R_SEQ 0x0011 /**< Re-recordable
|
|
|
|
|
DVD using
|
|
|
|
|
Sequential
|
|
|
|
|
recording */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_RAM 0x0012 /**< Re-writable
|
|
|
|
|
DVD */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_RW_RO 0x0013 /**< Re-recordable
|
|
|
|
|
DVD using
|
|
|
|
|
Restricted
|
|
|
|
|
Overwrite */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ 0x0014 /**< Re-recordable
|
|
|
|
|
DVD using
|
|
|
|
|
Sequential
|
|
|
|
|
recording */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_PRW 0x001A /**< DVD+RW - DVD
|
|
|
|
|
ReWritable */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DVD_PR 0x001B /**< DVD+R - DVD
|
|
|
|
|
Recordable */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DDCD_ROM 0x0020 /**< Read only
|
|
|
|
|
DDCD */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DDCD_R 0x0021 /**< DDCD-R Write
|
|
|
|
|
only DDCD */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_DDCD_RW 0x0022 /**< Re-Write only
|
|
|
|
|
DDCD */
|
|
|
|
|
#define CDIO_MMC_FEATURE_PROF_NON_CONFORM 0xFFFF /**< The Logical
|
|
|
|
|
Unit does not
|
|
|
|
|
conform to any
|
|
|
|
|
Profile. */
|
2004-08-06 11:55:16 +00:00
|
|
|
|
2004-05-26 06:29:15 +00:00
|
|
|
/*! This is listed as optional in ATAPI 2.6, but is (curiously)
|
|
|
|
|
missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
|
|
|
|
|
Table 377 as an MMC command for SCSi devices though... Most ATAPI
|
|
|
|
|
drives support it. */
|
|
|
|
|
#define CDIO_MMC_GPCMD_SET_SPEED 0xbb
|
|
|
|
|
|
|
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
/*! The largest Command Descriptor Buffer (CDB) size.
|
|
|
|
|
The possible sizes are 6, 10, and 12 bytes.
|
|
|
|
|
*/
|
|
|
|
|
#define MAX_CDB_LEN 12
|
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
/*! \brief A Command Descriptor Buffer (CDB) used in sending SCSI MMC
|
2004-07-22 09:52:17 +00:00
|
|
|
commands.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct scsi_mmc_cdb {
|
|
|
|
|
uint8_t field[MAX_CDB_LEN];
|
|
|
|
|
} scsi_mmc_cdb_t;
|
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
/*! \brief Format of header block in data returned from a SCSI-MMC
|
|
|
|
|
GET_CONFIGURATION command.
|
|
|
|
|
*/
|
2004-08-01 11:29:13 +00:00
|
|
|
typedef struct scsi_mmc_feature_list_header {
|
2004-08-06 22:13:14 +00:00
|
|
|
unsigned char length_msb;
|
|
|
|
|
unsigned char length_1sb;
|
|
|
|
|
unsigned char length_2sb;
|
|
|
|
|
unsigned char length_lsb;
|
2004-08-01 11:29:13 +00:00
|
|
|
unsigned char reserved1;
|
|
|
|
|
unsigned char reserved2;
|
|
|
|
|
unsigned char profile_msb;
|
|
|
|
|
unsigned char profile_lsb;
|
|
|
|
|
} scs_mmc_feature_list_header_t;
|
|
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
/*! An enumeration indicating whether a SCSI MMC command is sending
|
|
|
|
|
data or getting data.
|
|
|
|
|
*/
|
|
|
|
|
typedef enum scsi_mmc_direction {
|
|
|
|
|
SCSI_MMC_DATA_READ,
|
|
|
|
|
SCSI_MMC_DATA_WRITE
|
|
|
|
|
} scsi_mmc_direction_t;
|
2004-04-30 21:36:53 +00:00
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_SET_COMMAND(cdb, command) \
|
|
|
|
|
cdb[0] = command
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_READ_TYPE(cdb, sector_type) \
|
|
|
|
|
cdb[1] = (sector_type << 2)
|
2004-07-29 02:16:20 +00:00
|
|
|
|
2004-08-06 22:08:07 +00:00
|
|
|
#define CDIO_MMC_GET_LEN16(p) \
|
|
|
|
|
(p[0]<<8) + p[1]
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_GET_LEN32(p) \
|
|
|
|
|
(p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3];
|
|
|
|
|
|
2004-07-29 02:16:20 +00:00
|
|
|
#define CDIO_MMC_SET_LEN16(cdb, pos, len) \
|
|
|
|
|
cdb[pos ] = (len >> 8) & 0xff; \
|
|
|
|
|
cdb[pos+1] = (len ) & 0xff
|
2003-09-18 13:31:07 +00:00
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_SET_READ_LBA(cdb, lba) \
|
|
|
|
|
cdb[2] = (lba >> 24) & 0xff; \
|
|
|
|
|
cdb[3] = (lba >> 16) & 0xff; \
|
|
|
|
|
cdb[4] = (lba >> 8) & 0xff; \
|
|
|
|
|
cdb[5] = (lba ) & 0xff
|
2003-09-14 09:36:32 +00:00
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_SET_START_TRACK(cdb, command) \
|
|
|
|
|
cdb[6] = command
|
2004-04-30 21:36:53 +00:00
|
|
|
|
2004-07-28 11:45:21 +00:00
|
|
|
#define CDIO_MMC_SET_READ_LENGTH24(cdb, len) \
|
2004-07-22 09:52:17 +00:00
|
|
|
cdb[6] = (len >> 16) & 0xff; \
|
|
|
|
|
cdb[7] = (len >> 8) & 0xff; \
|
|
|
|
|
cdb[8] = (len ) & 0xff
|
2003-09-14 09:36:32 +00:00
|
|
|
|
2004-07-28 11:45:21 +00:00
|
|
|
#define CDIO_MMC_SET_READ_LENGTH16(cdb, len) \
|
2004-07-29 02:16:20 +00:00
|
|
|
CDIO_MMC_SET_LEN16(cdb, 7, len)
|
2004-07-28 11:45:21 +00:00
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_READ_LENGTH8(cdb, len) \
|
|
|
|
|
cdb[8] = (len ) & 0xff
|
|
|
|
|
|
2003-09-20 12:34:02 +00:00
|
|
|
#define CDIO_MMC_MCSB_ALL_HEADERS 0x78
|
|
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
#define CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS(cdb, val) \
|
|
|
|
|
cdb[9] = val;
|
|
|
|
|
|
|
|
|
|
/*!
|
2004-12-04 12:01:48 +00:00
|
|
|
Return the length in bytes of the Command Descriptor
|
|
|
|
|
Buffer (CDB) for a given SCSI MMC command. The length will be
|
2004-07-22 09:52:17 +00:00
|
|
|
either 6, 10, or 12.
|
|
|
|
|
*/
|
|
|
|
|
uint8_t scsi_mmc_get_cmd_len(uint8_t scsi_cmd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Run a SCSI MMC command.
|
|
|
|
|
|
|
|
|
|
cdio CD structure set by cdio_open().
|
2004-07-28 01:09:59 +00:00
|
|
|
i_timeout_ms time in milliseconds we will wait for the command
|
|
|
|
|
to complete.
|
2004-07-23 11:29:49 +00:00
|
|
|
p_cdb CDB bytes. All values that are needed should be set on
|
2004-07-22 09:52:17 +00:00
|
|
|
input. We'll figure out what the right CDB length should be.
|
2004-07-23 11:29:49 +00:00
|
|
|
e_direction direction the transfer is to go.
|
|
|
|
|
i_buf Size of buffer
|
|
|
|
|
p_buf Buffer for data, both sending and receiving.
|
2004-07-22 09:52:17 +00:00
|
|
|
|
|
|
|
|
Returns 0 if command completed successfully.
|
|
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
int scsi_mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
2004-07-22 09:52:17 +00:00
|
|
|
const scsi_mmc_cdb_t *p_cdb,
|
|
|
|
|
scsi_mmc_direction_t e_direction, unsigned int i_buf,
|
|
|
|
|
/*in/out*/ void *p_buf );
|
2004-07-26 02:54:37 +00:00
|
|
|
/*!
|
2005-01-18 00:57:19 +00:00
|
|
|
* Eject using SCSI MMC commands.
|
|
|
|
|
|
|
|
|
|
@return 0 if successful.
|
2004-07-26 02:54:37 +00:00
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
int scsi_mmc_eject_media( const CdIo_t *p_cdio);
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2004-12-04 11:50:40 +00:00
|
|
|
/*!
|
|
|
|
|
Return the discmode as reported by the SCSI-MMC Read (FULL) TOC
|
|
|
|
|
command.
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2004-12-04 11:50:40 +00:00
|
|
|
Information was obtained from Section 5.1.13 (Read TOC/PMA/ATIP)
|
|
|
|
|
pages 56-62 from the SCSI MMC draft specification, revision 10a
|
|
|
|
|
at http://www.t10.org/ftp/t10/drafts/mmc/mmc-r10a.pdf See
|
|
|
|
|
especially tables 72, 73 and 75.
|
2004-07-31 07:43:26 +00:00
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
discmode_t scsi_mmc_get_discmode( const CdIo_t *p_cdio );
|
2004-12-04 11:50:40 +00:00
|
|
|
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2004-07-27 02:45:16 +00:00
|
|
|
/*!
|
2005-01-18 00:57:19 +00:00
|
|
|
Get drive capabilities for a device.
|
|
|
|
|
@return the drive capabilities.
|
2004-07-27 02:45:16 +00:00
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
void scsi_mmc_get_drive_cap (const CdIo_t *p_cdio,
|
2004-07-27 02:45:16 +00:00
|
|
|
/*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);
|
|
|
|
|
|
2004-07-26 03:58:25 +00:00
|
|
|
/*!
|
|
|
|
|
Get the DVD type associated with cd object.
|
2005-01-18 00:57:19 +00:00
|
|
|
|
|
|
|
|
@return the DVD discmode.
|
2004-07-26 03:58:25 +00:00
|
|
|
*/
|
|
|
|
|
discmode_t scsi_mmc_get_dvd_struct_physical ( const CdIo *p_cdio,
|
|
|
|
|
cdio_dvd_struct_t *s);
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2004-07-31 07:43:26 +00:00
|
|
|
/*!
|
|
|
|
|
Get the CD-ROM hardware info via a SCSI MMC INQUIRY command.
|
2005-01-18 00:57:19 +00:00
|
|
|
|
|
|
|
|
@return true if we were able to get hardware info, false if we had
|
|
|
|
|
an error.
|
2004-07-31 07:43:26 +00:00
|
|
|
*/
|
2005-01-05 04:16:11 +00:00
|
|
|
bool scsi_mmc_get_hwinfo ( const CdIo_t *p_cdio,
|
2004-08-27 02:50:13 +00:00
|
|
|
/* out*/ cdio_hwinfo_t *p_hw_info );
|
2004-07-27 01:06:01 +00:00
|
|
|
|
|
|
|
|
|
2004-07-31 07:43:26 +00:00
|
|
|
/*!
|
|
|
|
|
Get the media catalog number (MCN) from the CD via MMC.
|
|
|
|
|
|
|
|
|
|
@return the media catalog number r NULL if there is none or we
|
|
|
|
|
don't have the ability to get it.
|
|
|
|
|
|
|
|
|
|
Note: string is malloc'd so caller has to free() the returned
|
|
|
|
|
string when done with it.
|
|
|
|
|
|
|
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
char *scsi_mmc_get_mcn ( const CdIo_t *p_cdio );
|
2004-07-31 07:43:26 +00:00
|
|
|
|
2004-12-04 11:50:40 +00:00
|
|
|
/*! Packet driver to read mode2 sectors.
|
|
|
|
|
Can read only up to 25 blocks.
|
|
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
int scsi_mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf, lba_t lba,
|
2004-12-18 17:29:32 +00:00
|
|
|
int sector_type, unsigned int i_blocks);
|
2004-12-04 11:50:40 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Set the block size for subsequest read requests, via a SCSI MMC
|
|
|
|
|
MODE_SELECT 6 command.
|
|
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
int scsi_mmc_set_blocksize ( const CdIo_t *p_cdio, unsigned int i_bsize);
|
2004-12-18 17:29:32 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Set the block size for subsequest read requests, via a SCSI MMC
|
|
|
|
|
MODE_SENSE 6 command.
|
|
|
|
|
*/
|
2005-01-18 00:57:19 +00:00
|
|
|
int scsi_mmc_get_blocksize ( const CdIo_t *p_cdio );
|
2004-12-04 11:50:40 +00:00
|
|
|
|
2005-01-18 05:41:58 +00:00
|
|
|
/*!
|
|
|
|
|
Set the drive speed.
|
|
|
|
|
|
|
|
|
|
@return -1 if we had an error. is -2 returned if this is not
|
|
|
|
|
implemented for the current driver.
|
|
|
|
|
|
|
|
|
|
@see scsi_mmc_get_speed
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
scsi_mmc_set_speed( const CdIo_t *p_cdio, int i_speed );
|
|
|
|
|
|
|
|
|
|
|
2003-09-14 09:36:32 +00:00
|
|
|
#endif /* __SCSI_MMC_H__ */
|