2008-11-29 00:56:26 -05:00
|
|
|
|
/*
|
2010-01-28 05:06:15 -05:00
|
|
|
|
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Rocky Bernstein <rocky@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-02-05 13:50:07 -05:00
|
|
|
|
\file mmc.h
|
|
|
|
|
|
|
|
|
|
|
|
\brief Common definitions for MMC (Multimedia Commands). Applications
|
|
|
|
|
|
include this for direct MMC access.
|
|
|
|
|
|
|
|
|
|
|
|
The documents we make use of are described in several
|
|
|
|
|
|
specifications made by the SCSI committee T10
|
|
|
|
|
|
http://www.t10.org. In particular, SCSI Primary Commands (SPC),
|
|
|
|
|
|
SCSI Block Commands (SBC), and Multi-Media Commands (MMC). These
|
|
|
|
|
|
documents generally have a numeric level number appended. For
|
|
|
|
|
|
example SPC-3 refers to ``SCSI Primary Commands - 3'.
|
|
|
|
|
|
|
|
|
|
|
|
In year 2010 the current versions were SPC-3, SBC-2, MMC-5.
|
|
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __CDIO_MMC_H__
|
|
|
|
|
|
#define __CDIO_MMC_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include <cdio/cdio.h>
|
|
|
|
|
|
#include <cdio/types.h>
|
|
|
|
|
|
#include <cdio/dvd.h>
|
|
|
|
|
|
#include <cdio/audio.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
2010-02-05 07:40:31 -05:00
|
|
|
|
/* On GNU/Linux see <linux/byteorder/big_endian.h> and
|
|
|
|
|
|
<linux/byteorder/little_endian.h>
|
|
|
|
|
|
*/
|
|
|
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
|
|
# if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
|
|
|
|
|
|
# define __MMC_BIG_ENDIAN_BITFIELD
|
|
|
|
|
|
# endif
|
|
|
|
|
|
#else
|
|
|
|
|
|
# if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
|
|
|
|
|
|
# define __MMC_LITTLE_ENDIAN_BITFIELD
|
|
|
|
|
|
# endif
|
2010-02-04 04:24:43 -05:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2010-02-03 04:53:25 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Structure of a SCSI/MMC sense reply.
|
|
|
|
|
|
|
|
|
|
|
|
This has been adapted from GNU/Linux request_sense of <linux/cdrom.h>
|
|
|
|
|
|
include this for direct MMC access.
|
2010-02-05 13:50:07 -05:00
|
|
|
|
See SCSI Primary Commands-2 (SPC-3) table 26 page 38.
|
2010-02-03 04:53:25 -05:00
|
|
|
|
*/
|
2010-02-07 21:04:21 -05:00
|
|
|
|
typedef struct cdio_mmc_request_sense {
|
2010-02-04 04:24:43 -05:00
|
|
|
|
#if defined(__MMC_BIG_ENDIAN_BITFIELD)
|
2010-02-03 04:53:25 -05:00
|
|
|
|
uint8_t valid : 1; /**< valid bit is 1 if info is valid */
|
|
|
|
|
|
uint8_t error_code : 7;
|
|
|
|
|
|
#else
|
|
|
|
|
|
uint8_t error_code : 7;
|
|
|
|
|
|
uint8_t valid : 1; /**< valid bit is 1 if info is valid */
|
|
|
|
|
|
#endif
|
|
|
|
|
|
uint8_t segment_number;
|
2010-02-04 04:24:43 -05:00
|
|
|
|
#if defined(__MMC_BIG_ENDIAN_BITFIELD)
|
2010-02-03 04:53:25 -05:00
|
|
|
|
uint8_t filemark : 1; /**< manditory in sequential
|
|
|
|
|
|
* access devices */
|
|
|
|
|
|
uint8_t eom : 1; /**< end of medium. manditory in
|
|
|
|
|
|
* sequential access and
|
|
|
|
|
|
* printer devices */
|
|
|
|
|
|
uint8_t ili : 1; /**< incorrect length indicator */
|
|
|
|
|
|
uint8_t reserved1 : 1;
|
|
|
|
|
|
uint8_t sense_key : 4;
|
|
|
|
|
|
#else
|
|
|
|
|
|
uint8_t sense_key : 4;
|
|
|
|
|
|
uint8_t reserved1 : 1;
|
|
|
|
|
|
uint8_t ili : 1; /**< incorrect length indicator */
|
|
|
|
|
|
uint8_t eom : 1; /**< end of medium. manditory in
|
|
|
|
|
|
* sequential access and
|
|
|
|
|
|
* printer devices */
|
|
|
|
|
|
uint8_t filemark : 1; /**< manditory in sequential
|
|
|
|
|
|
* access devices */
|
|
|
|
|
|
#endif
|
|
|
|
|
|
uint8_t information[4];
|
|
|
|
|
|
uint8_t additional_sense_len; /**< Additional sense length (n-7) */
|
|
|
|
|
|
uint8_t command_info[4]; /**< Command-specific information */
|
|
|
|
|
|
uint8_t asc; /**< Additional sense code */
|
|
|
|
|
|
uint8_t ascq; /**< Additional sense code qualifier */
|
|
|
|
|
|
uint8_t fruc; /**< Field replaceable unit code */
|
|
|
|
|
|
uint8_t sks[3]; /**< Sense-key specific */
|
|
|
|
|
|
uint8_t asb[46]; /**< Additional sense bytes */
|
2010-02-07 21:04:21 -05:00
|
|
|
|
} cdio_mmc_request_sense_t;
|
2010-02-03 04:53:25 -05:00
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-02-05 03:37:27 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Meanings of the values of mmc_request_sense.sense_key
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef enum {
|
2010-02-07 21:04:21 -05:00
|
|
|
|
CDIO_MMC_SENSE_KEY_NO_SENSE = 0,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_RECOVERED_ERROR = 1,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_NOT_READY = 2,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_MEDIUM_ERROR = 3,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_HARDWARE_ERROR = 4,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_ILLEGAL_REQUEST = 5,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_UNIT_ATTENTION = 6,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_DATA_PROTECT = 7,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_BLANK_CHECK = 8,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_VENDOR_SPECIFIC = 9,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_COPY_ABORTED = 10,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_ABORTED_COMMAND = 11,
|
|
|
|
|
|
CDIO_MMC_SENSE_KEY_OBSOLTE = 12,
|
|
|
|
|
|
} cdio_mmc_sense_key_t;
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-02-05 03:37:27 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Maps a mmc_sense_key_t into a string name.
|
|
|
|
|
|
*/
|
|
|
|
|
|
extern const char mmc_sense_key2str[16][40];
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-02-05 03:37:27 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Set this to the maximum value in milliseconds that we will
|
|
|
|
|
|
wait on an MMC command.
|
|
|
|
|
|
*/
|
|
|
|
|
|
extern uint32_t mmc_timeout_ms;
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-02-05 03:37:27 -05:00
|
|
|
|
/**
|
|
|
|
|
|
The default timeout (non-read) is 6 seconds.
|
|
|
|
|
|
*/
|
|
|
|
|
|
#define MMC_TIMEOUT_DEFAULT 6000
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Set this to the maximum value in milliseconds that we will
|
|
|
|
|
|
wait on an MMC read command.
|
|
|
|
|
|
*/
|
|
|
|
|
|
extern uint32_t mmc_read_timeout_ms;
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-02-05 03:37:27 -05:00
|
|
|
|
/** The default read timeout is 3 minutes. */
|
|
|
|
|
|
#define MMC_READ_TIMEOUT_DEFAULT 3*60*1000
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
\brief The opcode-portion (generic packet commands) of an MMC command.
|
|
|
|
|
|
|
|
|
|
|
|
In general, those opcodes that end in 6 take a 6-byte command
|
|
|
|
|
|
descriptor, those that end in 10 take a 10-byte
|
|
|
|
|
|
descriptor and those that in in 12 take a 12-byte descriptor.
|
|
|
|
|
|
|
|
|
|
|
|
(Not that you need to know that, but it seems to be a
|
|
|
|
|
|
big deal in the MMC specification.)
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef enum {
|
2010-02-07 07:20:28 -05:00
|
|
|
|
CDIO_MMC_GPCMD_TEST_UNIT_READY = 0x00, /**< test if drive ready. */
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CDIO_MMC_GPCMD_INQUIRY = 0x12, /**< Request drive
|
|
|
|
|
|
information. */
|
|
|
|
|
|
CDIO_MMC_GPCMD_MODE_SELECT_6 = 0x15, /**< Select medium
|
|
|
|
|
|
(6 bytes). */
|
|
|
|
|
|
CDIO_MMC_GPCMD_MODE_SENSE_6 = 0x1a, /**< Get medium or device
|
|
|
|
|
|
information. Should be issued
|
|
|
|
|
|
before MODE SELECT to get
|
|
|
|
|
|
mode support or save current
|
|
|
|
|
|
settings. (6 bytes). */
|
2010-02-06 22:53:03 -05:00
|
|
|
|
CDIO_MMC_GPCMD_START_STOP_UNIT = 0x1b, /**< Enable/disable Disc
|
2009-12-25 08:36:02 -05:00
|
|
|
|
operations. (6 bytes). */
|
2010-02-07 19:21:33 -05:00
|
|
|
|
CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL
|
|
|
|
|
|
= 0x1e, /**< Enable/disable Disc
|
2009-12-25 08:36:02 -05:00
|
|
|
|
removal. (6 bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Group 2 Commands (CDB's here are 10-bytes)
|
|
|
|
|
|
*/
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_10 = 0x28, /**< Read data from drive
|
|
|
|
|
|
(10 bytes). */
|
|
|
|
|
|
CDIO_MMC_GPCMD_READ_SUBCHANNEL = 0x42, /**< Read Sub-Channel data.
|
|
|
|
|
|
(10 bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_TOC = 0x43, /**< READ TOC/PMA/ATIP.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
(10 bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_HEADER = 0x44,
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CDIO_MMC_GPCMD_PLAY_AUDIO_10 = 0x45, /**< Begin audio playing at
|
|
|
|
|
|
current position
|
|
|
|
|
|
(10 bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_GET_CONFIGURATION = 0x46, /**< Get drive Capabilities
|
2009-12-25 08:36:02 -05:00
|
|
|
|
(10 bytes) */
|
|
|
|
|
|
CDIO_MMC_GPCMD_PLAY_AUDIO_MSF = 0x47, /**< Begin audio playing at
|
|
|
|
|
|
specified MSF (10
|
|
|
|
|
|
bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_PLAY_AUDIO_TI = 0x48,
|
|
|
|
|
|
CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 = 0x49, /**< Play audio at the track
|
2009-12-25 08:36:02 -05:00
|
|
|
|
relative LBA. (10 bytes).
|
|
|
|
|
|
Doesn't seem to be part
|
|
|
|
|
|
of MMC standards but is
|
|
|
|
|
|
handled by Plextor drives.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_GET_EVENT_STATUS = 0x4a, /**< Report events and
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Status. */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_PAUSE_RESUME = 0x4b, /**< Stop or restart audio
|
2009-12-25 08:36:02 -05:00
|
|
|
|
playback. (10 bytes).
|
|
|
|
|
|
Used with a PLAY command. */
|
|
|
|
|
|
|
|
|
|
|
|
CDIO_MMC_GPCMD_READ_DISC_INFO = 0x51, /**< Get CD information.
|
|
|
|
|
|
(10 bytes). */
|
2010-02-09 11:26:15 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_TRACK_INFORMATION = 0x52, /**< Information about a
|
|
|
|
|
|
logical track. */
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CDIO_MMC_GPCMD_MODE_SELECT_10 = 0x55, /**< Select medium
|
|
|
|
|
|
(10-bytes). */
|
|
|
|
|
|
CDIO_MMC_GPCMD_MODE_SENSE_10 = 0x5a, /**< Get medium or device
|
|
|
|
|
|
information. Should be issued
|
|
|
|
|
|
before MODE SELECT to get
|
|
|
|
|
|
mode support or save current
|
|
|
|
|
|
settings. (6 bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Group 5 Commands (CDB's here are 12-bytes)
|
|
|
|
|
|
*/
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CDIO_MMC_GPCMD_PLAY_AUDIO_12 = 0xa5, /**< Begin audio playing at
|
|
|
|
|
|
current position
|
|
|
|
|
|
(12 bytes) */
|
|
|
|
|
|
CDIO_MMC_GPCMD_LOAD_UNLOAD = 0xa6, /**< Load/unload a Disc
|
|
|
|
|
|
(12 bytes) */
|
|
|
|
|
|
CDIO_MMC_GPCMD_READ_12 = 0xa8, /**< Read data from drive
|
|
|
|
|
|
(12 bytes). */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 = 0xa9, /**< Play audio at the track
|
2009-12-25 08:36:02 -05:00
|
|
|
|
relative LBA. (12 bytes).
|
|
|
|
|
|
Doesn't seem to be part
|
|
|
|
|
|
of MMC standards but is
|
|
|
|
|
|
handled by Plextor drives.
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_DVD_STRUCTURE = 0xad, /**< Get DVD structure info
|
2009-12-25 08:36:02 -05:00
|
|
|
|
from media (12 bytes). */
|
|
|
|
|
|
CDIO_MMC_GPCMD_READ_MSF = 0xb9, /**< Read almost any field
|
|
|
|
|
|
of a CD sector at specified
|
|
|
|
|
|
MSF. (12 bytes). */
|
|
|
|
|
|
CDIO_MMC_GPCMD_SET_SPEED = 0xbb, /**< Set drive speed
|
|
|
|
|
|
(12 bytes). 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. */
|
|
|
|
|
|
CDIO_MMC_GPCMD_READ_CD = 0xbe, /**< Read almost any field
|
|
|
|
|
|
of a CD sector at current
|
|
|
|
|
|
location. (12 bytes). */
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Vendor-unique Commands
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS = 0xc4 /**< SONY unique = command */,
|
|
|
|
|
|
CDIO_MMC_GPCMD_PLAYBACK_CONTROL = 0xc9 /**< SONY unique = command */,
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_CDDA = 0xd8 /**< Vendor unique = command */,
|
|
|
|
|
|
CDIO_MMC_GPCMD_READ_CDXA = 0xdb /**< Vendor unique = command */,
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_GPCMD_READ_ALL_SUBCODES = 0xdf /**< Vendor unique = command */
|
|
|
|
|
|
} cdio_mmc_gpcmd_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Read Subchannel states
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_READ_SUB_ST_INVALID = 0x00, /**< audio status not supported */
|
|
|
|
|
|
CDIO_MMC_READ_SUB_ST_PLAY = 0x11, /**< audio play operation in
|
|
|
|
|
|
progress */
|
|
|
|
|
|
CDIO_MMC_READ_SUB_ST_PAUSED = 0x12, /**< audio play operation paused */
|
|
|
|
|
|
CDIO_MMC_READ_SUB_ST_COMPLETED = 0x13, /**< audio play successfully
|
|
|
|
|
|
completed */
|
|
|
|
|
|
CDIO_MMC_READ_SUB_ST_ERROR = 0x14, /**< audio play stopped due to
|
|
|
|
|
|
error */
|
|
|
|
|
|
CDIO_MMC_READ_SUB_ST_NO_STATUS = 0x15, /**< no current audio status to
|
|
|
|
|
|
return */
|
|
|
|
|
|
} cdio_mmc_read_sub_state_t;
|
|
|
|
|
|
|
|
|
|
|
|
/** Level values that can go into READ_CD */
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_READ_TYPE_ANY = 0, /**< All types */
|
|
|
|
|
|
CDIO_MMC_READ_TYPE_CDDA = 1, /**< Only CD-DA sectors */
|
|
|
|
|
|
CDIO_MMC_READ_TYPE_MODE1 = 2, /**< mode1 sectors (user data = 2048) */
|
|
|
|
|
|
CDIO_MMC_READ_TYPE_MODE2 = 3, /**< mode2 sectors form1 or form2 */
|
|
|
|
|
|
CDIO_MMC_READ_TYPE_M2F1 = 4, /**< mode2 sectors form1 */
|
|
|
|
|
|
CDIO_MMC_READ_TYPE_M2F2 = 5 /**< mode2 sectors form2 */
|
|
|
|
|
|
} cdio_mmc_read_cd_type_t;
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Format values for READ_TOC
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_READTOC_FMT_TOC = 0,
|
|
|
|
|
|
CDIO_MMC_READTOC_FMT_SESSION = 1,
|
|
|
|
|
|
CDIO_MMC_READTOC_FMT_FULTOC = 2,
|
|
|
|
|
|
CDIO_MMC_READTOC_FMT_PMA = 3, /**< Q subcode data */
|
|
|
|
|
|
CDIO_MMC_READTOC_FMT_ATIP = 4, /**< includes media type */
|
|
|
|
|
|
CDIO_MMC_READTOC_FMT_CDTEXT = 5 /**< CD-TEXT info */
|
|
|
|
|
|
} cdio_mmc_readtoc_t;
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Page codes for MODE SENSE and MODE SET.
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
typedef enum {
|
2010-02-09 22:39:05 -05:00
|
|
|
|
CDIO_MMC_R_W_ERROR_PAGE = 0x01,
|
|
|
|
|
|
CDIO_MMC_WRITE_PARMS_PAGE = 0x05,
|
|
|
|
|
|
CDIO_MMC_CDR_PARMS_PAGE = 0x0d,
|
|
|
|
|
|
CDIO_MMC_AUDIO_CTL_PAGE = 0x0e,
|
|
|
|
|
|
CDIO_MMC_POWER_PAGE = 0x1a,
|
|
|
|
|
|
CDIO_MMC_FAULT_FAIL_PAGE = 0x1c,
|
|
|
|
|
|
CDIO_MMC_TO_PROTECT_PAGE = 0x1d,
|
|
|
|
|
|
CDIO_MMC_CAPABILITIES_PAGE = 0x2a,
|
|
|
|
|
|
CDIO_MMC_ALL_PAGES = 0x3f,
|
2008-11-29 00:56:26 -05:00
|
|
|
|
} cdio_mmc_mode_page_t;
|
2010-02-09 22:39:05 -05:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
READ DISC INFORMATION Data Types
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_READ_DISC_INFO_STANDARD = 0x0,
|
|
|
|
|
|
CDIO_MMC_READ_DISC_INFO_TRACK = 0x1,
|
|
|
|
|
|
CDIO_MMC_READ_DISC_INFO_POW = 0x2,
|
|
|
|
|
|
} cdio_mmc_read_disc_info_datatype_t;
|
|
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
PRAGMA_BEGIN_PACKED
|
|
|
|
|
|
struct mmc_audio_volume_entry_s
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t selection; /* Only the lower 4 bits are used. */
|
|
|
|
|
|
uint8_t volume;
|
|
|
|
|
|
} GNUC_PACKED;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct mmc_audio_volume_entry_s mmc_audio_volume_entry_t;
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
This struct is used by cdio_audio_get_volume and cdio_audio_set_volume
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
struct mmc_audio_volume_s
|
|
|
|
|
|
{
|
|
|
|
|
|
mmc_audio_volume_entry_t port[4];
|
|
|
|
|
|
} GNUC_PACKED;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct mmc_audio_volume_s mmc_audio_volume_t;
|
|
|
|
|
|
|
|
|
|
|
|
PRAGMA_END_PACKED
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Return type codes for GET_CONFIGURATION.
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_GET_CONF_ALL_FEATURES = 0, /**< all features without regard
|
|
|
|
|
|
to currency. */
|
|
|
|
|
|
CDIO_MMC_GET_CONF_CURRENT_FEATURES = 1, /**< features which are currently
|
|
|
|
|
|
in effect (e.g. based on
|
|
|
|
|
|
medium inserted). */
|
|
|
|
|
|
CDIO_MMC_GET_CONF_NAMED_FEATURE = 2 /**< just the feature named in
|
|
|
|
|
|
the GET_CONFIGURATION cdb. */
|
|
|
|
|
|
} cdio_mmc_get_conf_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
FEATURE codes used in GET CONFIGURATION.
|
|
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROFILE_LIST = 0x000, /**< Profile List Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_CORE = 0x001,
|
|
|
|
|
|
CDIO_MMC_FEATURE_MORPHING = 0x002, /**< Report/prevent operational
|
|
|
|
|
|
changes */
|
|
|
|
|
|
CDIO_MMC_FEATURE_REMOVABLE_MEDIUM = 0x003, /**< Removable Medium Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_WRITE_PROTECT = 0x004, /**< Write Protect Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_RANDOM_READABLE = 0x010, /**< Random Readable Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_MULTI_READ = 0x01D, /**< Multi-Read Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_CD_READ = 0x01E, /**< CD Read Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_DVD_READ = 0x01F, /**< DVD Read Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_RANDOM_WRITABLE = 0x020, /**< Random Writable Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_INCR_WRITE = 0x021, /**< Incremental Streaming
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Writable Feature */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_SECTOR_ERASE = 0x022, /**< Sector Erasable Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_FORMATABLE = 0x023, /**< Formattable Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_DEFECT_MGMT = 0x024, /**< Management Ability of the
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Logical Unit/media system to
|
|
|
|
|
|
provide an apparently
|
|
|
|
|
|
defect-free space.*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_WRITE_ONCE = 0x025, /**< Write Once
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Feature */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_RESTRICT_OVERW = 0x026, /**< Restricted Overwrite
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Feature */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_CD_RW_CAV = 0x027, /**< CD-RW CAV Write Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_MRW = 0x028, /**< MRW Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_ENHANCED_DEFECT = 0x029, /**< Enhanced Defect Reporting */
|
|
|
|
|
|
CDIO_MMC_FEATURE_DVD_PRW = 0x02A, /**< DVD+RW Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_DVD_PR = 0x02B, /**< DVD+R Feature */
|
|
|
|
|
|
CDIO_MMC_FEATURE_RIGID_RES_OVERW = 0x02C, /**< Rigid Restricted Overwrite */
|
|
|
|
|
|
CDIO_MMC_FEATURE_CD_TAO = 0x02D, /**< CD Track at Once */
|
|
|
|
|
|
CDIO_MMC_FEATURE_CD_SAO = 0x02E, /**< CD Mastering (Session at
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Once) */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_DVD_R_RW_WRITE = 0x02F, /**< DVD-R/RW Write */
|
|
|
|
|
|
CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE= 0x037, /**< CD-RW Media Write Support */
|
|
|
|
|
|
CDIO_MMC_FEATURE_DVD_PR_2_LAYER = 0x03B, /**< DVD+R Double Layer */
|
|
|
|
|
|
CDIO_MMC_FEATURE_POWER_MGMT = 0x100, /**< Initiator and device directed
|
2009-12-25 08:36:02 -05:00
|
|
|
|
power management */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_CDDA_EXT_PLAY = 0x103, /**< Ability to play audio CDs
|
2009-12-25 08:36:02 -05:00
|
|
|
|
via the Logical Unit's own
|
|
|
|
|
|
analog output */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_MCODE_UPGRADE = 0x104, /* Ability for the device to
|
2009-12-25 08:36:02 -05:00
|
|
|
|
accept new microcode via
|
|
|
|
|
|
the interface */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_TIME_OUT = 0x105, /**< Ability to respond to all
|
2009-12-25 08:36:02 -05:00
|
|
|
|
commands within a specific
|
|
|
|
|
|
time */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_DVD_CSS = 0x106, /**< Ability to perform DVD
|
2009-12-25 08:36:02 -05:00
|
|
|
|
CSS/CPPM authentication and
|
|
|
|
|
|
RPC */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_RT_STREAMING = 0x107, /**< Ability to read and write
|
2009-12-25 08:36:02 -05:00
|
|
|
|
using Initiator requested
|
|
|
|
|
|
performance parameters */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_LU_SN = 0x108, /**< The Logical Unit has a unique
|
2009-12-25 08:36:02 -05:00
|
|
|
|
identifier. */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date
|
2009-12-25 08:36:02 -05:00
|
|
|
|
report */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
} cdio_mmc_feature_t;
|
2009-12-25 08:36:02 -05:00
|
|
|
|
|
2010-01-28 19:38:34 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
typedef enum {
|
2010-02-07 21:04:21 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disc, capable
|
2009-12-25 08:36:02 -05:00
|
|
|
|
of changing behavior */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_REMOVABLE = 0x0002, /**< disk Re-writable; with
|
2009-12-25 08:36:02 -05:00
|
|
|
|
removable media */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_MO_ERASABLE = 0x0003, /**< Erasable Magneto-Optical
|
2009-12-25 08:36:02 -05:00
|
|
|
|
disk with sector erase
|
|
|
|
|
|
capability */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE = 0x0004, /**< Write Once Magneto-Optical
|
2009-12-25 08:36:02 -05:00
|
|
|
|
write once */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_AS_MO = 0x0005, /**< Advance Storage
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Magneto-Optical */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_CD_ROM = 0x0008, /**< Read only Compact Disc
|
2009-12-25 08:36:02 -05:00
|
|
|
|
capable */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_CD_R = 0x0009, /**< Write once Compact Disc
|
2009-12-25 08:36:02 -05:00
|
|
|
|
capable */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_CD_RW = 0x000A, /**< CD-RW Re-writable
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Compact Disc capable */
|
2010-01-29 04:48:38 -05:00
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_ROM = 0x0010, /**< Read only DVD */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_R_SEQ = 0x0011, /**< Re-recordable DVD using
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Sequential recording */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_RAM = 0x0012, /**< Re-writable DVD */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_RW_RO = 0x0013, /**< Re-recordable DVD using
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Restricted Overwrite */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ = 0x0014, /**< Re-recordable DVD using
|
2009-12-25 08:36:02 -05:00
|
|
|
|
Sequential recording */
|
2010-01-29 04:48:38 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_R_DL_SEQ = 0x0015, /**< DVD-R/DL sequential
|
|
|
|
|
|
recording */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_R_DL_JR = 0x0016, /**< DVD-R/DL layer jump
|
|
|
|
|
|
recording */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_PRW = 0x001A, /**< DVD+RW - DVD ReWritable */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_PR = 0x001B, /**< DVD+R - DVD Recordable */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DDCD_ROM = 0x0020, /**< Read only DDCD */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DDCD_R = 0x0021, /**< DDCD-R Write only DDCD */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DDCD_RW = 0x0022, /**< Re-Write only DDCD */
|
2010-02-08 19:01:14 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_PRW_DL = 0x002A, /**< "DVD+RW/DL */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_DVD_PR_DL = 0x002B, /**< DVD+R - DVD Recordable
|
2008-11-29 00:56:26 -05:00
|
|
|
|
double layer */
|
2010-01-29 04:48:38 -05:00
|
|
|
|
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_BD_ROM = 0x0040, /**< BD-ROM */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_BD_SEQ = 0x0041, /**< BD-R sequential
|
|
|
|
|
|
recording */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_BD_R_RANDOM = 0x0042, /**< BD-R random recording */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_BD_RE = 0x0043, /**< BD-RE */
|
|
|
|
|
|
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_HD_DVD_ROM = 0x0050, /**< HD-DVD-ROM */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_HD_DVD_R = 0x0051, /**< HD-DVD-R */
|
|
|
|
|
|
CDIO_MMC_FEATURE_PROF_HD_DVD_RAM = 0x0052, /**<"HD-DVD-RAM */
|
|
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not
|
2009-12-25 08:36:02 -05:00
|
|
|
|
conform to any Profile. */
|
2008-11-29 00:56:26 -05:00
|
|
|
|
} cdio_mmc_feature_profile_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED = 0,
|
|
|
|
|
|
CDIO_MMC_FEATURE_INTERFACE_SCSI = 1,
|
|
|
|
|
|
CDIO_MMC_FEATURE_INTERFACE_ATAPI = 2,
|
|
|
|
|
|
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394 = 3,
|
|
|
|
|
|
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A = 4,
|
|
|
|
|
|
CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH = 5
|
|
|
|
|
|
} cdio_mmc_feature_interface_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
The largest Command Descriptor Block (CDB) size.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
The possible sizes are 6, 10, and 12 bytes.
|
2010-01-28 05:06:15 -05:00
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
#define MAX_CDB_LEN 12
|
|
|
|
|
|
|
2010-01-28 19:38:34 -05:00
|
|
|
|
/**
|
|
|
|
|
|
\brief A Command Descriptor Block (CDB) used in sending MMC
|
2008-11-29 00:56:26 -05:00
|
|
|
|
commands.
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef struct mmc_cdb_s {
|
|
|
|
|
|
uint8_t field[MAX_CDB_LEN];
|
|
|
|
|
|
} mmc_cdb_t;
|
|
|
|
|
|
|
2010-01-28 19:38:34 -05:00
|
|
|
|
/**
|
|
|
|
|
|
\brief Format of header block in data returned from an MMC
|
2008-11-29 00:56:26 -05:00
|
|
|
|
GET_CONFIGURATION command.
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef struct mmc_feature_list_header_s {
|
|
|
|
|
|
unsigned char length_msb;
|
|
|
|
|
|
unsigned char length_1sb;
|
|
|
|
|
|
unsigned char length_2sb;
|
|
|
|
|
|
unsigned char length_lsb;
|
|
|
|
|
|
unsigned char reserved1;
|
|
|
|
|
|
unsigned char reserved2;
|
|
|
|
|
|
unsigned char profile_msb;
|
|
|
|
|
|
unsigned char profile_lsb;
|
2009-12-25 08:36:02 -05:00
|
|
|
|
} cdio_mmc_feature_list_header_t;
|
|
|
|
|
|
|
2010-01-28 19:38:34 -05:00
|
|
|
|
/**
|
|
|
|
|
|
An enumeration indicating whether an MMC command is sending
|
|
|
|
|
|
data, or getting data, or does none of both.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
*/
|
|
|
|
|
|
typedef enum mmc_direction_s {
|
|
|
|
|
|
SCSI_MMC_DATA_READ,
|
2009-12-19 18:17:18 -05:00
|
|
|
|
SCSI_MMC_DATA_WRITE,
|
|
|
|
|
|
SCSI_MMC_DATA_NONE
|
2009-12-25 08:36:02 -05:00
|
|
|
|
} cdio_mmc_direction_t;
|
2010-01-28 19:38:34 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Indicate to applications that SCSI_MMC_DATA_NONE is available.
|
|
|
|
|
|
It has been added after version 0.82 and should be used with commands
|
|
|
|
|
|
that neither read nor write payload bytes. (At least on Linux such
|
|
|
|
|
|
commands did work with SCSI_MMC_DATA_READ or SCSI_MMC_DATA_WRITE, too.)
|
2008-11-29 00:56:26 -05:00
|
|
|
|
*/
|
2009-12-19 18:17:18 -05:00
|
|
|
|
#define SCSI_MMC_HAS_DIR_NONE 1
|
2009-12-25 08:36:02 -05:00
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
typedef struct mmc_subchannel_s
|
2009-12-25 08:36:02 -05:00
|
|
|
|
{
|
2008-11-29 00:56:26 -05:00
|
|
|
|
uint8_t reserved;
|
|
|
|
|
|
uint8_t audio_status;
|
|
|
|
|
|
uint16_t data_length; /**< Really ISO 9660 7.2.2 */
|
2009-12-25 08:36:02 -05:00
|
|
|
|
uint8_t format;
|
|
|
|
|
|
uint8_t address: 4;
|
|
|
|
|
|
uint8_t control: 4;
|
|
|
|
|
|
uint8_t track;
|
|
|
|
|
|
uint8_t index;
|
2008-11-29 00:56:26 -05:00
|
|
|
|
uint8_t abs_addr[4];
|
|
|
|
|
|
uint8_t rel_addr[4];
|
|
|
|
|
|
} cdio_mmc_subchannel_t;
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_COMMAND(cdb, command) \
|
|
|
|
|
|
cdb[0] = command
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_READ_TYPE(cdb, sector_type) \
|
|
|
|
|
|
cdb[1] = (sector_type << 2)
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_GETPOS_LEN16(p, pos) \
|
|
|
|
|
|
(p[pos]<<8) + p[pos+1]
|
|
|
|
|
|
|
|
|
|
|
|
#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];
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_LEN16(cdb, pos, len) \
|
|
|
|
|
|
cdb[pos ] = (len >> 8) & 0xff; \
|
|
|
|
|
|
cdb[pos+1] = (len ) & 0xff
|
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_START_TRACK(cdb, command) \
|
|
|
|
|
|
cdb[6] = command
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_READ_LENGTH24(cdb, len) \
|
|
|
|
|
|
cdb[6] = (len >> 16) & 0xff; \
|
|
|
|
|
|
cdb[7] = (len >> 8) & 0xff; \
|
|
|
|
|
|
cdb[8] = (len ) & 0xff
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_READ_LENGTH16(cdb, len) \
|
|
|
|
|
|
CDIO_MMC_SET_LEN16(cdb, 7, len)
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_READ_LENGTH8(cdb, len) \
|
|
|
|
|
|
cdb[8] = (len ) & 0xff
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_MCSB_ALL_HEADERS 0xf
|
|
|
|
|
|
|
|
|
|
|
|
#define CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS(cdb, val) \
|
|
|
|
|
|
cdb[9] = val << 3;
|
|
|
|
|
|
|
2010-01-28 19:38:34 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Get the output port volumes and port selections used on AUDIO PLAY
|
|
|
|
|
|
commands via a MMC MODE SENSE command using the CD Audio Control
|
|
|
|
|
|
Page.
|
|
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@param p_volume volume parameters retrieved
|
|
|
|
|
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t mmc_audio_get_volume (CdIo_t *p_cdio, /*out*/
|
|
|
|
|
|
mmc_audio_volume_t *p_volume);
|
|
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Read Audio Subchannel information
|
|
|
|
|
|
|
|
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@param p_subchannel place for returned subchannel information
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t
|
|
|
|
|
|
mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|
|
|
|
|
/*out*/ cdio_subchannel_t *p_subchannel);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Return a string containing the name of the audio state as returned from
|
|
|
|
|
|
the Q_SUBCHANNEL.
|
|
|
|
|
|
*/
|
|
|
|
|
|
const char *mmc_audio_state2str( uint8_t i_audio_state );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Return a string containing the name of the given feature
|
|
|
|
|
|
*/
|
|
|
|
|
|
const char *mmc_feature2str( int i_feature );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Return a string containing the name of the given feature
|
|
|
|
|
|
*/
|
|
|
|
|
|
const char *mmc_feature_profile2str( int i_feature_profile );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-01-28 05:06:15 -05:00
|
|
|
|
Get the block size used in read requests, via MMC (e.g. READ_10,
|
|
|
|
|
|
READ_MSF, ...)
|
|
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@return the blocksize if > 0; error if <= 0
|
2008-11-29 00:56:26 -05:00
|
|
|
|
*/
|
|
|
|
|
|
int mmc_get_blocksize ( CdIo_t *p_cdio );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-01-28 19:38:34 -05:00
|
|
|
|
Return the length in bytes of the Command Descriptor
|
|
|
|
|
|
Buffer (CDB) for a given MMC command. The length will be
|
|
|
|
|
|
either 6, 10, or 12.
|
2010-01-28 05:06:15 -05:00
|
|
|
|
*/
|
2010-01-28 19:38:34 -05:00
|
|
|
|
uint8_t mmc_get_cmd_len(uint8_t mmc_cmd);
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Get the lsn of the end of the CD
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@return the lsn. On error return CDIO_INVALID_LSN.
|
|
|
|
|
|
*/
|
|
|
|
|
|
lsn_t mmc_get_disc_last_lsn( const CdIo_t *p_cdio );
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Return the discmode as reported by the MMC Read (FULL) TOC
|
|
|
|
|
|
command.
|
|
|
|
|
|
|
|
|
|
|
|
Information was obtained from Section 5.1.13 (Read TOC/PMA/ATIP)
|
|
|
|
|
|
pages 56-62 from the MMC draft specification, revision 10a
|
|
|
|
|
|
at http://www.t10.org/ftp/t10/drafts/mmc/mmc-r10a.pdf See
|
|
|
|
|
|
especially tables 72, 73 and 75.
|
|
|
|
|
|
*/
|
|
|
|
|
|
discmode_t mmc_get_discmode( const CdIo_t *p_cdio );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Get drive capabilities for a device.
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
2010-01-28 10:36:59 -05:00
|
|
|
|
@param p_read_cap list of read capabilities that are set on return
|
|
|
|
|
|
@param p_write_cap list of write capabilities that are set on return
|
|
|
|
|
|
@param p_misc_cap list of miscellaneous capabilities (that are neither
|
|
|
|
|
|
read nor write related) that are set on return
|
2008-11-29 00:56:26 -05:00
|
|
|
|
*/
|
|
|
|
|
|
void mmc_get_drive_cap ( CdIo_t *p_cdio,
|
|
|
|
|
|
/*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);
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
|
CDIO_MMC_LEVEL_WEIRD,
|
|
|
|
|
|
CDIO_MMC_LEVEL_1,
|
|
|
|
|
|
CDIO_MMC_LEVEL_2,
|
|
|
|
|
|
CDIO_MMC_LEVEL_3,
|
|
|
|
|
|
CDIO_MMC_LEVEL_NONE
|
|
|
|
|
|
} cdio_mmc_level_t;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Get the MMC level supported by the device.
|
2010-01-28 10:36:59 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@return MMC level supported by the device.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
*/
|
|
|
|
|
|
cdio_mmc_level_t mmc_get_drive_mmc_cap(CdIo_t *p_cdio);
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Get the DVD type associated with cd object.
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
2010-01-28 10:36:59 -05:00
|
|
|
|
@param s location to store DVD information.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@return the DVD discmode.
|
|
|
|
|
|
*/
|
|
|
|
|
|
discmode_t mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,
|
|
|
|
|
|
cdio_dvd_struct_t *s);
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Find out if media tray is open or closed.
|
|
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@return 1 if media is open, 0 if closed. Error
|
|
|
|
|
|
return codes are the same as driver_return_code_t
|
|
|
|
|
|
*/
|
|
|
|
|
|
int mmc_get_tray_status ( const CdIo_t *p_cdio );
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Get the CD-ROM hardware info via an MMC INQUIRY command.
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
2010-01-28 10:36:59 -05:00
|
|
|
|
@param p_hw_info place to store hardware information retrieved
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@return true if we were able to get hardware info, false if we had
|
|
|
|
|
|
an error.
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool mmc_get_hwinfo ( const CdIo_t *p_cdio,
|
|
|
|
|
|
/* out*/ cdio_hwinfo_t *p_hw_info );
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Find out if media has changed since the last call.
|
|
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@return 1 if media has changed since last call, 0 if not. Error
|
|
|
|
|
|
return codes are the same as driver_return_code_t
|
|
|
|
|
|
*/
|
|
|
|
|
|
int mmc_get_media_changed(const CdIo_t *p_cdio);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Get the media catalog number (MCN) from the CD via MMC.
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@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.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
2010-02-07 21:04:21 -05:00
|
|
|
|
char * mmc_get_mcn(const CdIo_t *p_cdio);
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
/**
|
2010-02-08 21:49:50 -05:00
|
|
|
|
Report if CD-ROM has a particular kind of interface (ATAPI, SCSCI, ...)
|
|
|
|
|
|
Is it possible for an interface to have several? If not this
|
2008-11-29 00:56:26 -05:00
|
|
|
|
routine could probably return the single mmc_feature_interface_t.
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
2010-01-28 10:36:59 -05:00
|
|
|
|
@param e_interface
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@return true if we have the interface and false if not.
|
|
|
|
|
|
*/
|
2010-02-07 21:04:21 -05:00
|
|
|
|
bool_3way_t mmc_have_interface(CdIo_t *p_cdio,
|
|
|
|
|
|
cdio_mmc_feature_interface_t e_interface );
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-02-08 19:01:14 -05:00
|
|
|
|
bool mmc_is_disctype_bd(cdio_mmc_feature_profile_t disctype);
|
|
|
|
|
|
bool mmc_is_disctype_cdrom(cdio_mmc_feature_profile_t disctype);
|
|
|
|
|
|
bool mmc_is_disctype_dvd(cdio_mmc_feature_profile_t disctype);
|
|
|
|
|
|
bool mmc_is_disctype_hd_dvd (cdio_mmc_feature_profile_t disctype);
|
|
|
|
|
|
bool mmc_is_disctype_overwritable (cdio_mmc_feature_profile_t disctype);
|
|
|
|
|
|
bool mmc_is_disctype_rewritable(cdio_mmc_feature_profile_t disctype);
|
2010-02-07 21:04:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Read just the user data part of some sort of data sector (via
|
|
|
|
|
|
mmc_read_cd).
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_cdio object to read from
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param p_buf place to read data into. The caller should make
|
|
|
|
|
|
sure this location can store at least CDIO_CD_FRAMESIZE,
|
|
|
|
|
|
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on the
|
|
|
|
|
|
kind of sector getting read. If you don't know whether
|
|
|
|
|
|
you have a Mode 1/2, Form 1/ Form 2/Formless sector best
|
|
|
|
|
|
to reserve space for the maximum, M2RAW_SECTOR_SIZE.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
@param i_lsn sector to read
|
|
|
|
|
|
@param i_blocksize size of each block
|
|
|
|
|
|
@param i_blocks number of blocks to read
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t mmc_read_data_sectors ( CdIo_t *p_cdio, void *p_buf,
|
|
|
|
|
|
lsn_t i_lsn,
|
|
|
|
|
|
uint16_t i_blocksize,
|
|
|
|
|
|
uint32_t i_blocks );
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Read sectors using SCSI-MMC GPCMD_READ_CD.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
Can read only up to 25 blocks.
|
2010-01-28 05:06:15 -05:00
|
|
|
|
*/
|
2008-11-29 00:56:26 -05:00
|
|
|
|
driver_return_code_t mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf,
|
|
|
|
|
|
lsn_t i_lsn, int read_sector_type,
|
|
|
|
|
|
uint32_t i_blocks);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Run a Multimedia command (MMC).
|
|
|
|
|
|
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param p_cdio CD structure set by cdio_open().
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@param i_timeout_ms time in milliseconds we will wait for the command
|
|
|
|
|
|
to complete.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param p_cdb CDB bytes. All values that are needed should be set
|
2008-11-29 00:56:26 -05:00
|
|
|
|
on input. We'll figure out what the right CDB length
|
|
|
|
|
|
should be.
|
|
|
|
|
|
@param e_direction direction the transfer is to go.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param i_buf Size of buffer
|
|
|
|
|
|
@param p_buf Buffer for data, both sending and receiving.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
@return 0 if command completed successfully.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t
|
|
|
|
|
|
mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
|
|
|
|
|
const mmc_cdb_t *p_cdb,
|
|
|
|
|
|
cdio_mmc_direction_t e_direction, unsigned int i_buf,
|
|
|
|
|
|
/*in/out*/ void *p_buf );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
Run a Multimedia command (MMC) specifying the CDB length.
|
|
|
|
|
|
The motivation here is for example ot use in is an undocumented
|
|
|
|
|
|
debug command for LG drives (namely E7), whose length is being
|
|
|
|
|
|
miscalculated by mmc_get_cmd_len(); it doesn't follow the usual
|
|
|
|
|
|
code number to length conventions. Patch supplied by SukkoPera.
|
|
|
|
|
|
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param p_cdio CD structure set by cdio_open().
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@param i_timeout_ms time in milliseconds we will wait for the command
|
|
|
|
|
|
to complete.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param p_cdb CDB bytes. All values that are needed should be set
|
2008-11-29 00:56:26 -05:00
|
|
|
|
on input.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param i_cdb number of CDB bytes.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
@param e_direction direction the transfer is to go.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
@param i_buf Size of buffer
|
|
|
|
|
|
@param p_buf Buffer for data, both sending and receiving.
|
2008-11-29 00:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
@return 0 if command completed successfully.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t
|
|
|
|
|
|
mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
|
|
|
|
|
const mmc_cdb_t *p_cdb, unsigned int i_cdb,
|
|
|
|
|
|
cdio_mmc_direction_t e_direction, unsigned int i_buf,
|
|
|
|
|
|
/*in/out*/ void *p_buf );
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Obtain the SCSI sense reply of the most-recently-performed MMC command.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
These bytes give an indication of possible problems which occured in
|
|
|
|
|
|
the drive while the command was performed. With some commands they tell
|
|
|
|
|
|
about the current state of the drive (e.g. 00h TEST UNIT READY).
|
2010-02-05 13:50:07 -05:00
|
|
|
|
@param p_cdio CD structure set by cdio_open().
|
|
|
|
|
|
|
|
|
|
|
|
@param sense returns the sense bytes received from the drive.
|
|
|
|
|
|
This is allocated memory or NULL if no sense bytes are
|
|
|
|
|
|
available. Dispose non-NULL pointers by free() when no longer
|
|
|
|
|
|
needed. See SPC-3 4.5.3 Fixed format sense data. SCSI error
|
|
|
|
|
|
codes as of SPC-3 Annex D, MMC-5 Annex F: sense[2]&15 = Key ,
|
|
|
|
|
|
sense[12] = ASC , sense[13] = ASCQ
|
|
|
|
|
|
|
|
|
|
|
|
@return number of valid bytes in sense, 0 in case of no sense
|
|
|
|
|
|
bytes available, <0 in case of internal error.
|
2009-12-25 08:36:02 -05:00
|
|
|
|
*/
|
2010-02-07 21:04:21 -05:00
|
|
|
|
int mmc_last_cmd_sense ( const CdIo_t *p_cdio,
|
|
|
|
|
|
cdio_mmc_request_sense_t **pp_sense);
|
2009-12-25 08:36:02 -05:00
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
/**
|
|
|
|
|
|
Set the block size for subsequest read requests, via MMC.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t mmc_set_blocksize ( const CdIo_t *p_cdio,
|
|
|
|
|
|
uint16_t i_blocksize);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
2010-01-28 05:06:15 -05:00
|
|
|
|
/**
|
|
|
|
|
|
The below variables are trickery to force the above enum symbol
|
2008-11-29 00:56:26 -05:00
|
|
|
|
values to be recorded in debug symbol tables. They are used to
|
|
|
|
|
|
allow one to refer to the enumeration value names in the typedefs
|
|
|
|
|
|
above in a debugger and debugger expressions
|
|
|
|
|
|
*/
|
|
|
|
|
|
extern cdio_mmc_feature_t debug_cdio_mmc_feature;
|
|
|
|
|
|
extern cdio_mmc_feature_interface_t debug_cdio_mmc_feature_interface;
|
|
|
|
|
|
extern cdio_mmc_feature_profile_t debug_cdio_mmc_feature_profile;
|
|
|
|
|
|
extern cdio_mmc_get_conf_t debug_cdio_mmc_get_conf;
|
|
|
|
|
|
extern cdio_mmc_gpcmd_t debug_cdio_mmc_gpcmd;
|
|
|
|
|
|
extern cdio_mmc_read_sub_state_t debug_cdio_mmc_read_sub_state;
|
|
|
|
|
|
extern cdio_mmc_read_cd_type_t debug_cdio_mmc_read_cd_type;
|
|
|
|
|
|
extern cdio_mmc_readtoc_t debug_cdio_mmc_readtoc;
|
|
|
|
|
|
extern cdio_mmc_mode_page_t debug_cdio_mmc_mode_page;
|
|
|
|
|
|
|
2010-02-06 22:53:03 -05:00
|
|
|
|
#ifndef DO_NOT_WANT_OLD_MMC_COMPATIBILITY
|
|
|
|
|
|
#define CDIO_MMC_GPCMD_START_STOP CDIO_MMC_GPCMD_START_STOP_UNIT
|
2010-02-07 19:21:33 -05:00
|
|
|
|
#define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL \
|
|
|
|
|
|
CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL
|
2010-02-06 22:53:03 -05:00
|
|
|
|
#endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/
|
|
|
|
|
|
|
2008-11-29 00:56:26 -05:00
|
|
|
|
#endif /* __MMC_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Local variables:
|
|
|
|
|
|
* c-file-style: "gnu"
|
|
|
|
|
|
* tab-width: 8
|
|
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
|
|
* End:
|
|
|
|
|
|
*/
|