libcdio  0.90
Data Structures | Defines | Typedefs | Enumerations | Functions | Variables
mmc.h File Reference

Common definitions for MMC (Multimedia Commands). Applications include this for direct MMC access. More...

#include <cdio/cdio.h>
#include <cdio/types.h>
#include <cdio/dvd.h>
#include <cdio/audio.h>
#include <cdio/mmc_util.h>

Go to the source code of this file.

Data Structures

struct  cdio_mmc_request_sense
struct  mmc_audio_volume_entry_s
struct  mmc_audio_volume_s
struct  mmc_cdb_s
 A Command Descriptor Block (CDB) used in sending MMC commands. More...
struct  mmc_feature_list_header_s
 Format of header block in data returned from an MMC GET_CONFIGURATION command. More...
struct  mmc_subchannel_s

Defines

#define __MMC_LITTLE_ENDIAN_BITFIELD
#define CDIO_MMC_GPCMD_READ_DISC_INFO   CDIO_MMC_GPCMD_READ_DISC_INFORMATION
#define CDIO_MMC_GPCMD_READ_DISC_STRUCTURE   CDIO_MMC_GPMD_READ_DVD_STRUCTURE
#define MAX_CDB_LEN   12
#define SCSI_MMC_HAS_DIR_NONE   1
#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)
#define CDIO_MMC_SET_READ_LBA(cdb, lba)
#define CDIO_MMC_SET_START_TRACK(cdb, command)   cdb[6] = command
#define CDIO_MMC_SET_READ_LENGTH24(cdb, len)
#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;
#define CDIO_MMC_GPCMD_START_STOP   CDIO_MMC_GPCMD_START_STOP_UNIT
#define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL   CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL

Typedefs

typedef struct
cdio_mmc_request_sense 
cdio_mmc_request_sense_t
typedef struct
mmc_audio_volume_entry_s 
mmc_audio_volume_entry_t
typedef struct mmc_audio_volume_s mmc_audio_volume_t
typedef struct mmc_cdb_s mmc_cdb_t
 A Command Descriptor Block (CDB) used in sending MMC commands.
typedef struct
mmc_feature_list_header_s 
cdio_mmc_feature_list_header_t
 Format of header block in data returned from an MMC GET_CONFIGURATION command.
typedef enum mmc_direction_s cdio_mmc_direction_t
typedef struct mmc_subchannel_s cdio_mmc_subchannel_t

Enumerations

enum  cdio_mmc_sense_key_t {
  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_OBSOLETE = 12
}
enum  cdio_mmc_gpcmd_t {
  CDIO_MMC_GPCMD_TEST_UNIT_READY = 0x00, CDIO_MMC_GPCMD_REQUEST_SENSE = 0x03, CDIO_MMC_GPCMD_FORMAT_UNIT = 0x04, CDIO_MMC_GPCMD_INQUIRY = 0x12,
  CDIO_MMC_GPCMD_MODE_SELECT_6 = 0x15, CDIO_MMC_GPCMD_MODE_SENSE_6 = 0x1a, CDIO_MMC_GPCMD_START_STOP_UNIT = 0x1b, CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e,
  CDIO_MMC_GPCMD_READ_FORMAT_CAPACITIES = 0x23, CDIO_MMC_GPCMD_READ_CAPACITIY = 0x25, CDIO_MMC_GPCMD_READ_10 = 0x28, CDIO_MMC_GPCMD_WRITE_10 = 0x2a,
  CDIO_MMC_GPCMD_SEEK_10 = 0x2b, CDIO_MMC_GPCMD_ERASE_10 = 0x2c, CDIO_MMC_GPCMD_WRITE_AND_VERIFY_10 = 0x2e, CDIO_MMC_GPCMD_VERIFY_10 = 0x2f,
  CDIO_MMC_GPCMD_SYNCHRONIZE_CACHE = 0x35, CDIO_MMC_GPCMD_WRITE_BUFFER = 0x3b, CDIO_MMC_GPCMD_READ_BUFFER = 0x3c, CDIO_MMC_GPCMD_READ_SUBCHANNEL = 0x42,
  CDIO_MMC_GPCMD_READ_TOC = 0x43, CDIO_MMC_GPCMD_READ_HEADER = 0x44, CDIO_MMC_GPCMD_PLAY_AUDIO_10 = 0x45, CDIO_MMC_GPCMD_GET_CONFIGURATION = 0x46,
  CDIO_MMC_GPCMD_PLAY_AUDIO_MSF = 0x47, CDIO_MMC_GPCMD_PLAY_AUDIO_TI = 0x48, CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 = 0x49, CDIO_MMC_GPCMD_GET_EVENT_STATUS = 0x4a,
  CDIO_MMC_GPCMD_PAUSE_RESUME = 0x4b, CDIO_MMC_GPCMD_READ_DISC_INFORMATION = 0x51, CDIO_MMC_GPCMD_READ_TRACK_INFORMATION = 0x52, CDIO_MMC_GPCMD_RESERVE_TRACK = 0x53,
  CDIO_MMC_GPCMD_SEND_OPC_INFORMATION = 0x54, CDIO_MMC_GPCMD_MODE_SELECT_10 = 0x55, CDIO_MMC_GPCMD_REPAIR_TRACK = 0x58, CDIO_MMC_GPCMD_MODE_SENSE_10 = 0x5a,
  CDIO_MMC_GPCMD_CLOSE_TRACK_SESSION = 0x5b, CDIO_MMC_GPCMD_READ_BUFFER_CAPACITY = 0x5c, CDIO_MMC_GPCMD_SEND_CUE_SHEET = 0x5d, CDIO_MMC_GPCMD_REPORT_LUNS = 0xa0,
  CDIO_MMC_GPCMD_BLANK = 0xa1, CDIO_MMC_GPCMD_SECURITY_PROTOCOL_IN = 0xa2, CDIO_MMC_GPCMD_SEND_KEY = 0xa3, CDIO_MMC_GPCMD_REPORT_KEY = 0xa4,
  CDIO_MMC_GPCMD_PLAY_AUDIO_12 = 0xa5, CDIO_MMC_GPCMD_LOAD_UNLOAD = 0xa6, CDIO_MMC_GPCMD_SET_READ_AHEAD = 0xa7, CDIO_MMC_GPCMD_READ_12 = 0xa8,
  CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 = 0xa9, CDIO_MMC_GPCMD_WRITE_12 = 0xaa, CDIO_MMC_GPCMD_READ_MEDIA_SERIAL_12 = 0xab, CDIO_MMC_GPCMD_GET_PERFORMANCE = 0xac,
  CDIO_MMC_GPCMD_READ_DVD_STRUCTURE = 0xad, CDIO_MMC_GPCMD_SECURITY_PROTOCOL_OUT = 0xb5, CDIO_MMC_GPCMD_SET_STREAMING = 0xb6, CDIO_MMC_GPCMD_READ_MSF = 0xb9,
  CDIO_MMC_GPCMD_SET_SPEED = 0xbb, CDIO_MMC_GPCMD_MECHANISM_STATUS = 0xbd, CDIO_MMC_GPCMD_READ_CD = 0xbe, CDIO_MMC_GPCMD_SEND_DISC_STRUCTURE = 0xbf,
  CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS = 0xc4, CDIO_MMC_GPCMD_PLAYBACK_CONTROL = 0xc9, CDIO_MMC_GPCMD_READ_CDDA = 0xd8, CDIO_MMC_GPCMD_READ_CDXA = 0xdb,
  CDIO_MMC_GPCMD_READ_ALL_SUBCODES = 0xdf
}
 The opcode-portion (generic packet commands) of an MMC command. More...
enum  cdio_mmc_read_sub_state_t {
  CDIO_MMC_READ_SUB_ST_INVALID = 0x00, CDIO_MMC_READ_SUB_ST_PLAY = 0x11, CDIO_MMC_READ_SUB_ST_PAUSED = 0x12, CDIO_MMC_READ_SUB_ST_COMPLETED = 0x13,
  CDIO_MMC_READ_SUB_ST_ERROR = 0x14, CDIO_MMC_READ_SUB_ST_NO_STATUS = 0x15
}
enum  cdio_mmc_read_cd_type_t {
  CDIO_MMC_READ_TYPE_ANY = 0, CDIO_MMC_READ_TYPE_CDDA = 1, CDIO_MMC_READ_TYPE_MODE1 = 2, CDIO_MMC_READ_TYPE_MODE2 = 3,
  CDIO_MMC_READ_TYPE_M2F1 = 4, CDIO_MMC_READ_TYPE_M2F2 = 5
}
enum  cdio_mmc_readtoc_t {
  CDIO_MMC_READTOC_FMT_TOC = 0, CDIO_MMC_READTOC_FMT_SESSION = 1, CDIO_MMC_READTOC_FMT_FULTOC = 2, CDIO_MMC_READTOC_FMT_PMA = 3,
  CDIO_MMC_READTOC_FMT_ATIP = 4, CDIO_MMC_READTOC_FMT_CDTEXT = 5
}
enum  cdio_mmc_mode_page_t {
  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
}
enum  cdio_mmc_read_disc_info_datatype_t { CDIO_MMC_READ_DISC_INFO_STANDARD = 0x0, CDIO_MMC_READ_DISC_INFO_TRACK = 0x1, CDIO_MMC_READ_DISC_INFO_POW = 0x2 }
enum  cdio_mmc_get_conf_t { CDIO_MMC_GET_CONF_ALL_FEATURES = 0, CDIO_MMC_GET_CONF_CURRENT_FEATURES = 1, CDIO_MMC_GET_CONF_NAMED_FEATURE = 2 }
enum  cdio_mmc_feature_t {
  CDIO_MMC_FEATURE_PROFILE_LIST = 0x000, CDIO_MMC_FEATURE_CORE = 0x001, CDIO_MMC_FEATURE_MORPHING = 0x002, CDIO_MMC_FEATURE_REMOVABLE_MEDIUM = 0x003,
  CDIO_MMC_FEATURE_WRITE_PROTECT = 0x004, CDIO_MMC_FEATURE_RANDOM_READABLE = 0x010, CDIO_MMC_FEATURE_MULTI_READ = 0x01D, CDIO_MMC_FEATURE_CD_READ = 0x01E,
  CDIO_MMC_FEATURE_DVD_READ = 0x01F, CDIO_MMC_FEATURE_RANDOM_WRITABLE = 0x020, CDIO_MMC_FEATURE_INCR_WRITE = 0x021, CDIO_MMC_FEATURE_SECTOR_ERASE = 0x022,
  CDIO_MMC_FEATURE_FORMATABLE = 0x023, CDIO_MMC_FEATURE_DEFECT_MGMT = 0x024, CDIO_MMC_FEATURE_WRITE_ONCE = 0x025, CDIO_MMC_FEATURE_RESTRICT_OVERW = 0x026,
  CDIO_MMC_FEATURE_CD_RW_CAV = 0x027, CDIO_MMC_FEATURE_MRW = 0x028, CDIO_MMC_FEATURE_ENHANCED_DEFECT = 0x029, CDIO_MMC_FEATURE_DVD_PRW = 0x02A,
  CDIO_MMC_FEATURE_DVD_PR = 0x02B, CDIO_MMC_FEATURE_RIGID_RES_OVERW = 0x02C, CDIO_MMC_FEATURE_CD_TAO = 0x02D, CDIO_MMC_FEATURE_CD_SAO = 0x02E,
  CDIO_MMC_FEATURE_DVD_R_RW_WRITE = 0x02F, CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE = 0x037, CDIO_MMC_FEATURE_DVD_PR_2_LAYER = 0x03B, CDIO_MMC_FEATURE_POWER_MGMT = 0x100,
  CDIO_MMC_FEATURE_CDDA_EXT_PLAY = 0x103, CDIO_MMC_FEATURE_MCODE_UPGRADE = 0x104, CDIO_MMC_FEATURE_TIME_OUT = 0x105, CDIO_MMC_FEATURE_DVD_CSS = 0x106,
  CDIO_MMC_FEATURE_RT_STREAMING = 0x107, CDIO_MMC_FEATURE_LU_SN = 0x108, CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF
}
enum  cdio_mmc_feature_interface_t {
  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
}
enum  mmc_direction_s { SCSI_MMC_DATA_READ, SCSI_MMC_DATA_WRITE, SCSI_MMC_DATA_NONE }
enum  cdio_mmc_level_t {
  CDIO_MMC_LEVEL_WEIRD, CDIO_MMC_LEVEL_1, CDIO_MMC_LEVEL_2, CDIO_MMC_LEVEL_3,
  CDIO_MMC_LEVEL_NONE
}

Functions

driver_return_code_t mmc_audio_get_volume (CdIo_t *p_cdio, mmc_audio_volume_t *p_volume)
driver_return_code_t mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
driver_return_code_t mmc_isrc_track_read_subchannel (CdIo_t *p_cdio, const track_t track, char *p_isrc)
const char * mmc_audio_state2str (uint8_t i_audio_state)
int mmc_get_blocksize (CdIo_t *p_cdio)
uint8_t mmc_get_cmd_len (uint8_t mmc_cmd)
lsn_t mmc_get_disc_last_lsn (const CdIo_t *p_cdio)
discmode_t mmc_get_discmode (const CdIo_t *p_cdio)
cdio_mmc_level_t mmc_get_drive_mmc_cap (CdIo_t *p_cdio)
discmode_t mmc_get_dvd_struct_physical (const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
int mmc_get_tray_status (const CdIo_t *p_cdio)
bool mmc_get_hwinfo (const CdIo_t *p_cdio, cdio_hwinfo_t *p_hw_info)
int mmc_get_media_changed (const CdIo_t *p_cdio)
char * mmc_get_mcn (const CdIo_t *p_cdio)
bool_3way_t mmc_have_interface (CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface)
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)
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)
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, void *p_buf)
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, void *p_buf)
int mmc_last_cmd_sense (const CdIo_t *p_cdio, cdio_mmc_request_sense_t **pp_sense)
driver_return_code_t mmc_set_blocksize (const CdIo_t *p_cdio, uint16_t i_blocksize)
const char * mmc_cmd2str (uint8_t command)

Variables

PRAGMA_BEGIN_PACKED struct
mmc_audio_volume_entry_s 
GNUC_PACKED
cdio_mmc_feature_t debug_cdio_mmc_feature
cdio_mmc_feature_interface_t debug_cdio_mmc_feature_interface
cdio_mmc_feature_profile_t debug_cdio_mmc_feature_profile
cdio_mmc_get_conf_t debug_cdio_mmc_get_conf
cdio_mmc_gpcmd_t debug_cdio_mmc_gpcmd
cdio_mmc_read_sub_state_t debug_cdio_mmc_read_sub_state
cdio_mmc_read_cd_type_t debug_cdio_mmc_read_cd_type
cdio_mmc_readtoc_t debug_cdio_mmc_readtoc
cdio_mmc_mode_page_t debug_cdio_mmc_mode_page

Detailed Description

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.


Define Documentation

#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_GETPOS_LEN16 (   p,
  pos 
)    (p[pos]<<8) + p[pos+1]
#define CDIO_MMC_GPCMD_READ_DISC_STRUCTURE   CDIO_MMC_GPMD_READ_DVD_STRUCTURE
#define CDIO_MMC_MCSB_ALL_HEADERS   0xf
#define CDIO_MMC_SET_COMMAND (   cdb,
  command 
)    cdb[0] = command
#define CDIO_MMC_SET_LEN16 (   cdb,
  pos,
  len 
)
Value:
cdb[pos  ] = (len >>  8) & 0xff;              \
  cdb[pos+1] = (len      ) & 0xff
#define CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS (   cdb,
  val 
)    cdb[9] = val << 3;
#define CDIO_MMC_SET_READ_LBA (   cdb,
  lba 
)
Value:
cdb[2] = (lba >> 24) & 0xff; \
  cdb[3] = (lba >> 16) & 0xff; \
  cdb[4] = (lba >>  8) & 0xff; \
  cdb[5] = (lba      ) & 0xff
#define CDIO_MMC_SET_READ_LENGTH16 (   cdb,
  len 
)    CDIO_MMC_SET_LEN16(cdb, 7, len)
#define CDIO_MMC_SET_READ_LENGTH24 (   cdb,
  len 
)
Value:
cdb[6] = (len >> 16) & 0xff; \
  cdb[7] = (len >>  8) & 0xff; \
  cdb[8] = (len      ) & 0xff
#define CDIO_MMC_SET_READ_LENGTH8 (   cdb,
  len 
)    cdb[8] = (len ) & 0xff
#define CDIO_MMC_SET_READ_TYPE (   cdb,
  sector_type 
)    cdb[1] = (sector_type << 2)
#define CDIO_MMC_SET_START_TRACK (   cdb,
  command 
)    cdb[6] = command
#define MAX_CDB_LEN   12

The largest Command Descriptor Block (CDB) size. The possible sizes are 6, 10, and 12 bytes.

#define SCSI_MMC_HAS_DIR_NONE   1

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.)


Typedef Documentation

An enumeration indicating whether an MMC command is sending data, or getting data, or does none of both.

Format of header block in data returned from an MMC GET_CONFIGURATION command.

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. See SCSI Primary Commands-2 (SPC-3) table 26 page 38.

typedef struct mmc_cdb_s mmc_cdb_t

A Command Descriptor Block (CDB) used in sending MMC commands.


Enumeration Type Documentation

Enumerator:
CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED 
CDIO_MMC_FEATURE_INTERFACE_SCSI 
CDIO_MMC_FEATURE_INTERFACE_ATAPI 
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394 
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A 
CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH 

FEATURE codes used in GET CONFIGURATION.

Enumerator:
CDIO_MMC_FEATURE_PROFILE_LIST 

Profile List Feature

CDIO_MMC_FEATURE_CORE 
CDIO_MMC_FEATURE_MORPHING 

Report/prevent operational changes

CDIO_MMC_FEATURE_REMOVABLE_MEDIUM 

Removable Medium Feature

CDIO_MMC_FEATURE_WRITE_PROTECT 

Write Protect Feature

CDIO_MMC_FEATURE_RANDOM_READABLE 

Random Readable Feature

CDIO_MMC_FEATURE_MULTI_READ 

Multi-Read Feature

CDIO_MMC_FEATURE_CD_READ 

CD Read Feature

CDIO_MMC_FEATURE_DVD_READ 

DVD Read Feature

CDIO_MMC_FEATURE_RANDOM_WRITABLE 

Random Writable Feature

CDIO_MMC_FEATURE_INCR_WRITE 

Incremental Streaming Writable Feature

CDIO_MMC_FEATURE_SECTOR_ERASE 

Sector Erasable Feature

CDIO_MMC_FEATURE_FORMATABLE 

Formattable Feature

CDIO_MMC_FEATURE_DEFECT_MGMT 

Management Ability of the Logical Unit/media system to provide an apparently defect-free space.

CDIO_MMC_FEATURE_WRITE_ONCE 

Write Once Feature

CDIO_MMC_FEATURE_RESTRICT_OVERW 

Restricted Overwrite Feature

CDIO_MMC_FEATURE_CD_RW_CAV 

CD-RW CAV Write Feature

CDIO_MMC_FEATURE_MRW 

MRW Feature

CDIO_MMC_FEATURE_ENHANCED_DEFECT 

Enhanced Defect Reporting

CDIO_MMC_FEATURE_DVD_PRW 

DVD+RW Feature

CDIO_MMC_FEATURE_DVD_PR 

DVD+R Feature

CDIO_MMC_FEATURE_RIGID_RES_OVERW 

Rigid Restricted Overwrite

CDIO_MMC_FEATURE_CD_TAO 

CD Track at Once

CDIO_MMC_FEATURE_CD_SAO 

CD Mastering (Session at Once)

CDIO_MMC_FEATURE_DVD_R_RW_WRITE 

DVD-R/RW Write

CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE 

CD-RW Media Write Support

CDIO_MMC_FEATURE_DVD_PR_2_LAYER 

DVD+R Double Layer

CDIO_MMC_FEATURE_POWER_MGMT 

Initiator and device directed power management

CDIO_MMC_FEATURE_CDDA_EXT_PLAY 

Ability to play audio CDs via the Logical Unit's own analog output

CDIO_MMC_FEATURE_MCODE_UPGRADE 
CDIO_MMC_FEATURE_TIME_OUT 

Ability to respond to all commands within a specific time

CDIO_MMC_FEATURE_DVD_CSS 

Ability to perform DVD CSS/CPPM authentication and RPC

CDIO_MMC_FEATURE_RT_STREAMING 

Ability to read and write using Initiator requested performance parameters

CDIO_MMC_FEATURE_LU_SN 

The Logical Unit has a unique identifier.

CDIO_MMC_FEATURE_FIRMWARE_DATE 

Firmware creation date report

Return type codes for GET_CONFIGURATION.

Enumerator:
CDIO_MMC_GET_CONF_ALL_FEATURES 

all features without regard to currency.

CDIO_MMC_GET_CONF_CURRENT_FEATURES 

features which are currently in effect (e.g. based on medium inserted).

CDIO_MMC_GET_CONF_NAMED_FEATURE 

just the feature named in the GET_CONFIGURATION cdb.

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.)

Enumerator:
CDIO_MMC_GPCMD_TEST_UNIT_READY 

test if drive ready.

CDIO_MMC_GPCMD_REQUEST_SENSE 
CDIO_MMC_GPCMD_FORMAT_UNIT 
CDIO_MMC_GPCMD_INQUIRY 

Request drive information.

CDIO_MMC_GPCMD_MODE_SELECT_6 

Select medium (6 bytes).

CDIO_MMC_GPCMD_MODE_SENSE_6 

Get medium or device information. Should be issued before MODE SELECT to get mode support or save current settings. (6 bytes).

CDIO_MMC_GPCMD_START_STOP_UNIT 

Enable/disable Disc operations. (6 bytes).

CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 

Enable/disable Disc removal. (6 bytes).

CDIO_MMC_GPCMD_READ_FORMAT_CAPACITIES 

Group 2 Commands (CDB's here are 10-bytes) MMC-5 Section 6.24

CDIO_MMC_GPCMD_READ_CAPACITIY 

MMC-5 Section 6.19

CDIO_MMC_GPCMD_READ_10 

Read data from drive (10 bytes).

CDIO_MMC_GPCMD_WRITE_10 
CDIO_MMC_GPCMD_SEEK_10 
CDIO_MMC_GPCMD_ERASE_10 

MMC5 Section 6.4

CDIO_MMC_GPCMD_WRITE_AND_VERIFY_10 
CDIO_MMC_GPCMD_VERIFY_10 
CDIO_MMC_GPCMD_SYNCHRONIZE_CACHE 
CDIO_MMC_GPCMD_WRITE_BUFFER 
CDIO_MMC_GPCMD_READ_BUFFER 
CDIO_MMC_GPCMD_READ_SUBCHANNEL 

Read Sub-Channel data. (10 bytes).

CDIO_MMC_GPCMD_READ_TOC 

READ TOC/PMA/ATIP. (10 bytes).

CDIO_MMC_GPCMD_READ_HEADER 
CDIO_MMC_GPCMD_PLAY_AUDIO_10 

Begin audio playing at current position (10 bytes).

CDIO_MMC_GPCMD_GET_CONFIGURATION 

Get drive Capabilities (10 bytes)

CDIO_MMC_GPCMD_PLAY_AUDIO_MSF 

Begin audio playing at specified MSF (10 bytes).

CDIO_MMC_GPCMD_PLAY_AUDIO_TI 
CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 

Play audio at the track relative LBA. (10 bytes). Doesn't seem to be part of MMC standards but is handled by Plextor drives.

CDIO_MMC_GPCMD_GET_EVENT_STATUS 

Report events and Status.

CDIO_MMC_GPCMD_PAUSE_RESUME 

Stop or restart audio playback. (10 bytes). Used with a PLAY command.

CDIO_MMC_GPCMD_READ_DISC_INFORMATION 

Get CD information. (10 bytes).

CDIO_MMC_GPCMD_READ_TRACK_INFORMATION 

Information about a logical track.

CDIO_MMC_GPCMD_RESERVE_TRACK 
CDIO_MMC_GPCMD_SEND_OPC_INFORMATION 
CDIO_MMC_GPCMD_MODE_SELECT_10 

Select medium (10-bytes).

CDIO_MMC_GPCMD_REPAIR_TRACK 
CDIO_MMC_GPCMD_MODE_SENSE_10 

Get medium or device information. Should be issued before MODE SELECT to get mode support or save current settings. (6 bytes).

CDIO_MMC_GPCMD_CLOSE_TRACK_SESSION 
CDIO_MMC_GPCMD_READ_BUFFER_CAPACITY 
CDIO_MMC_GPCMD_SEND_CUE_SHEET 
CDIO_MMC_GPCMD_REPORT_LUNS 

Group 5 Commands (CDB's here are 12-bytes)

CDIO_MMC_GPCMD_BLANK 
CDIO_MMC_GPCMD_SECURITY_PROTOCOL_IN 
CDIO_MMC_GPCMD_SEND_KEY 
CDIO_MMC_GPCMD_REPORT_KEY 
CDIO_MMC_GPCMD_PLAY_AUDIO_12 

Begin audio playing at current position (12 bytes)

CDIO_MMC_GPCMD_LOAD_UNLOAD 

Load/unload a Disc (12 bytes)

CDIO_MMC_GPCMD_SET_READ_AHEAD 
CDIO_MMC_GPCMD_READ_12 

Read data from drive (12 bytes).

CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 

Play audio at the track relative LBA. (12 bytes). Doesn't seem to be part of MMC standards but is handled by Plextor drives.

CDIO_MMC_GPCMD_WRITE_12 
CDIO_MMC_GPCMD_READ_MEDIA_SERIAL_12 

MMC-5 Section 6.25

CDIO_MMC_GPCMD_GET_PERFORMANCE 
CDIO_MMC_GPCMD_READ_DVD_STRUCTURE 

Get DVD structure info from media (12 bytes).

CDIO_MMC_GPCMD_SECURITY_PROTOCOL_OUT 
CDIO_MMC_GPCMD_SET_STREAMING 
CDIO_MMC_GPCMD_READ_MSF 

Read almost any field of a CD sector at specified MSF. (12 bytes).

CDIO_MMC_GPCMD_SET_SPEED 

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_MECHANISM_STATUS 
CDIO_MMC_GPCMD_READ_CD 

Read almost any field of a CD sector at current location. (12 bytes).

CDIO_MMC_GPCMD_SEND_DISC_STRUCTURE 
CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS 

Vendor-unique Commands SONY unique = command

CDIO_MMC_GPCMD_PLAYBACK_CONTROL 

SONY unique = command

CDIO_MMC_GPCMD_READ_CDDA 

Vendor unique = command

CDIO_MMC_GPCMD_READ_CDXA 

Vendor unique = command

CDIO_MMC_GPCMD_READ_ALL_SUBCODES 

Vendor unique = command

Enumerator:
CDIO_MMC_LEVEL_WEIRD 
CDIO_MMC_LEVEL_1 
CDIO_MMC_LEVEL_2 
CDIO_MMC_LEVEL_3 
CDIO_MMC_LEVEL_NONE 

Page codes for MODE SENSE and MODE SET.

Enumerator:
CDIO_MMC_R_W_ERROR_PAGE 
CDIO_MMC_WRITE_PARMS_PAGE 
CDIO_MMC_CDR_PARMS_PAGE 
CDIO_MMC_AUDIO_CTL_PAGE 
CDIO_MMC_POWER_PAGE 
CDIO_MMC_FAULT_FAIL_PAGE 
CDIO_MMC_TO_PROTECT_PAGE 
CDIO_MMC_CAPABILITIES_PAGE 
CDIO_MMC_ALL_PAGES 

Level values that can go into READ_CD

Enumerator:
CDIO_MMC_READ_TYPE_ANY 

All types

CDIO_MMC_READ_TYPE_CDDA 

Only CD-DA sectors

CDIO_MMC_READ_TYPE_MODE1 

mode1 sectors (user data = 2048)

CDIO_MMC_READ_TYPE_MODE2 

mode2 sectors form1 or form2

CDIO_MMC_READ_TYPE_M2F1 

mode2 sectors form1

CDIO_MMC_READ_TYPE_M2F2 

mode2 sectors form2

READ DISC INFORMATION Data Types

Enumerator:
CDIO_MMC_READ_DISC_INFO_STANDARD 
CDIO_MMC_READ_DISC_INFO_TRACK 
CDIO_MMC_READ_DISC_INFO_POW 

Read Subchannel states

Enumerator:
CDIO_MMC_READ_SUB_ST_INVALID 

audio status not supported

CDIO_MMC_READ_SUB_ST_PLAY 

audio play operation in progress

CDIO_MMC_READ_SUB_ST_PAUSED 

audio play operation paused

CDIO_MMC_READ_SUB_ST_COMPLETED 

audio play successfully completed

CDIO_MMC_READ_SUB_ST_ERROR 

audio play stopped due to error

CDIO_MMC_READ_SUB_ST_NO_STATUS 

no current audio status to return

Format values for READ_TOC

Enumerator:
CDIO_MMC_READTOC_FMT_TOC 
CDIO_MMC_READTOC_FMT_SESSION 
CDIO_MMC_READTOC_FMT_FULTOC 
CDIO_MMC_READTOC_FMT_PMA 

Q subcode data

CDIO_MMC_READTOC_FMT_ATIP 

includes media type

CDIO_MMC_READTOC_FMT_CDTEXT 

CD-TEXT info

Meanings of the values of mmc_request_sense.sense_key

Enumerator:
CDIO_MMC_SENSE_KEY_NO_SENSE 
CDIO_MMC_SENSE_KEY_RECOVERED_ERROR 
CDIO_MMC_SENSE_KEY_NOT_READY 
CDIO_MMC_SENSE_KEY_MEDIUM_ERROR 
CDIO_MMC_SENSE_KEY_HARDWARE_ERROR 
CDIO_MMC_SENSE_KEY_ILLEGAL_REQUEST 
CDIO_MMC_SENSE_KEY_UNIT_ATTENTION 
CDIO_MMC_SENSE_KEY_DATA_PROTECT 
CDIO_MMC_SENSE_KEY_BLANK_CHECK 
CDIO_MMC_SENSE_KEY_VENDOR_SPECIFIC 
CDIO_MMC_SENSE_KEY_COPY_ABORTED 
CDIO_MMC_SENSE_KEY_ABORTED_COMMAND 
CDIO_MMC_SENSE_KEY_OBSOLETE 

An enumeration indicating whether an MMC command is sending data, or getting data, or does none of both.

Enumerator:
SCSI_MMC_DATA_READ 
SCSI_MMC_DATA_WRITE 
SCSI_MMC_DATA_NONE 

Function Documentation

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.

Parameters:
p_cdiothe CD object to be acted upon.
p_volumevolume parameters retrieved
Returns:
DRIVER_OP_SUCCESS if we ran the command ok.

Read Audio Subchannel information

Parameters:
p_cdiothe CD object to be acted upon.
p_subchannelplace for returned subchannel information
const char* mmc_audio_state2str ( uint8_t  i_audio_state)

Return a string containing the name of the audio state as returned from the Q_SUBCHANNEL.

const char* mmc_cmd2str ( uint8_t  command)

Get string name for MMC command

Parameters:
commandcdio_mmc_gpcmd_t command value
Returns:
string name of command
int mmc_get_blocksize ( CdIo_t p_cdio)

Get the block size used in read requests, via MMC (e.g. READ_10, READ_MSF, ...)

Parameters:
p_cdiothe CD object to be acted upon.
Returns:
the blocksize if > 0; error if <= 0
uint8_t mmc_get_cmd_len ( uint8_t  mmc_cmd)

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.

lsn_t mmc_get_disc_last_lsn ( const CdIo_t p_cdio)

Get the lsn of the end of the CD

Parameters:
p_cdiothe CD object to be acted upon.
Returns:
the lsn. On error return CDIO_INVALID_LSN.
discmode_t mmc_get_discmode ( const CdIo_t p_cdio)

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.

Get the MMC level supported by the device.

Parameters:
p_cdiothe CD object to be acted upon.
Returns:
MMC level supported by the device.

Get the DVD type associated with cd object.

Parameters:
p_cdiothe CD object to be acted upon.
slocation to store DVD information.
Returns:
the DVD discmode.
bool mmc_get_hwinfo ( const CdIo_t p_cdio,
cdio_hwinfo_t p_hw_info 
)

Get the CD-ROM hardware info via an MMC INQUIRY command.

Parameters:
p_cdiothe CD object to be acted upon.
p_hw_infoplace to store hardware information retrieved
Returns:
true if we were able to get hardware info, false if we had an error.
char* mmc_get_mcn ( const CdIo_t p_cdio)

Get the media catalog number (MCN) from the CD via MMC.

Parameters:
p_cdiothe CD object to be acted upon.
Returns:
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.

int mmc_get_media_changed ( const CdIo_t p_cdio)

Find out if media has changed since the last call.

Parameters:
p_cdiothe CD object to be acted upon.
Returns:
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_tray_status ( const CdIo_t p_cdio)

Find out if media tray is open or closed.

Parameters:
p_cdiothe CD object to be acted upon.
Returns:
1 if media is open, 0 if closed. Error return codes are the same as driver_return_code_t

Report if CD-ROM has a particular kind of interface (ATAPI, SCSCI, ...) Is it possible for an interface to have several? If not this routine could probably return the single mmc_feature_interface_t.

Parameters:
p_cdiothe CD object to be acted upon.
e_interface
Returns:
true if we have the interface and false if not.
driver_return_code_t mmc_isrc_track_read_subchannel ( CdIo_t p_cdio,
const track_t  track,
char *  p_isrc 
)

Read ISRC Subchannel information. Contributed by Scot C. Bontrager (scot@indievisible.org) May 15, 2011 -

Parameters:
p_cdiothe CD object to be acted upon.
trackthe track you to get ISRC info
p_isrcplace to put ISRC info
int mmc_last_cmd_sense ( const CdIo_t p_cdio,
cdio_mmc_request_sense_t **  pp_sense 
)

Obtain the SCSI sense reply of the most-recently-performed MMC command. 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).

Parameters:
p_cdioCD structure set by cdio_open().
pp_sensereturns 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
Returns:
number of valid bytes in sense, 0 in case of no sense bytes available, <0 in case of internal error.
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 
)

Read just the user data part of some sort of data sector (via mmc_read_cd).

Parameters:
p_cdioobject to read from
p_bufplace 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.
i_lsnsector to read
i_blocksizesize of each block
i_blocksnumber of blocks to read
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 
)

Read sectors using SCSI-MMC GPCMD_READ_CD. Can read only up to 25 blocks.

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,
void *  p_buf 
)

Run a Multimedia command (MMC).

Parameters:
p_cdioCD structure set by cdio_open().
i_timeout_mstime in milliseconds we will wait for the command to complete.
p_cdbCDB bytes. All values that are needed should be set on input. We'll figure out what the right CDB length should be.
e_directiondirection the transfer is to go.
i_bufSize of buffer
p_bufBuffer for data, both sending and receiving.
Returns:
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,
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.

Parameters:
p_cdioCD structure set by cdio_open().
i_timeout_mstime in milliseconds we will wait for the command to complete.
p_cdbCDB bytes. All values that are needed should be set on input.
i_cdbnumber of CDB bytes.
e_directiondirection the transfer is to go.
i_bufSize of buffer
p_bufBuffer for data, both sending and receiving.
Returns:
0 if command completed successfully.
driver_return_code_t mmc_set_blocksize ( const CdIo_t p_cdio,
uint16_t  i_blocksize 
)

Set the block size for subsequest read requests, via MMC.


Variable Documentation

The below variables are trickery to force the above enum symbol 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