Regularis some of the mmc Doxygen comments.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
Rocky Bernstein <rocky@gnu.org>
|
Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -35,22 +35,28 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/** Set this to the maximum value in milliseconds that we will
|
/**
|
||||||
wait on an MMC command. */
|
Set this to the maximum value in milliseconds that we will
|
||||||
|
wait on an MMC command.
|
||||||
|
*/
|
||||||
extern uint32_t mmc_timeout_ms;
|
extern uint32_t mmc_timeout_ms;
|
||||||
|
|
||||||
/** The default timeout (non-read) is 6 seconds. */
|
/**
|
||||||
|
The default timeout (non-read) is 6 seconds.
|
||||||
|
*/
|
||||||
#define MMC_TIMEOUT_DEFAULT 6000
|
#define MMC_TIMEOUT_DEFAULT 6000
|
||||||
|
|
||||||
/** Set this to the maximum value in milliseconds that we will
|
/**
|
||||||
wait on an MMC read command. */
|
Set this to the maximum value in milliseconds that we will
|
||||||
|
wait on an MMC read command.
|
||||||
|
*/
|
||||||
extern uint32_t mmc_read_timeout_ms;
|
extern uint32_t mmc_read_timeout_ms;
|
||||||
|
|
||||||
/** The default read timeout is 3 minutes. */
|
/** The default read timeout is 3 minutes. */
|
||||||
#define MMC_READ_TIMEOUT_DEFAULT 3*60*1000
|
#define MMC_READ_TIMEOUT_DEFAULT 3*60*1000
|
||||||
|
|
||||||
|
/**
|
||||||
/** \brief The opcode-portion (generic packet commands) of an MMC command.
|
\brief The opcode-portion (generic packet commands) of an MMC command.
|
||||||
|
|
||||||
In general, those opcodes that end in 6 take a 6-byte 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, those that end in 10 take a 10-byte
|
||||||
@@ -75,7 +81,8 @@ extern "C" {
|
|||||||
CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL = 0x1e, /**< Enable/disable Disc
|
CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL = 0x1e, /**< Enable/disable Disc
|
||||||
removal. (6 bytes). */
|
removal. (6 bytes). */
|
||||||
|
|
||||||
/** Group 2 Commands (CDB's here are 10-bytes)
|
/**
|
||||||
|
Group 2 Commands (CDB's here are 10-bytes)
|
||||||
*/
|
*/
|
||||||
CDIO_MMC_GPCMD_READ_10 = 0x28, /**< Read data from drive
|
CDIO_MMC_GPCMD_READ_10 = 0x28, /**< Read data from drive
|
||||||
(10 bytes). */
|
(10 bytes). */
|
||||||
@@ -116,7 +123,8 @@ extern "C" {
|
|||||||
mode support or save current
|
mode support or save current
|
||||||
settings. (6 bytes). */
|
settings. (6 bytes). */
|
||||||
|
|
||||||
/** Group 5 Commands (CDB's here are 12-bytes)
|
/**
|
||||||
|
Group 5 Commands (CDB's here are 12-bytes)
|
||||||
*/
|
*/
|
||||||
CDIO_MMC_GPCMD_PLAY_AUDIO_12 = 0xa5, /**< Begin audio playing at
|
CDIO_MMC_GPCMD_PLAY_AUDIO_12 = 0xa5, /**< Begin audio playing at
|
||||||
current position
|
current position
|
||||||
@@ -149,7 +157,8 @@ extern "C" {
|
|||||||
CDIO_MMC_GPCMD_READ_CD = 0xbe, /**< Read almost any field
|
CDIO_MMC_GPCMD_READ_CD = 0xbe, /**< Read almost any field
|
||||||
of a CD sector at current
|
of a CD sector at current
|
||||||
location. (12 bytes). */
|
location. (12 bytes). */
|
||||||
/** Vendor-unique Commands
|
/**
|
||||||
|
Vendor-unique Commands
|
||||||
*/
|
*/
|
||||||
CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS = 0xc4 /**< SONY unique = command */,
|
CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS = 0xc4 /**< SONY unique = command */,
|
||||||
CDIO_MMC_GPCMD_PLAYBACK_CONTROL = 0xc9 /**< SONY unique = command */,
|
CDIO_MMC_GPCMD_PLAYBACK_CONTROL = 0xc9 /**< SONY unique = command */,
|
||||||
@@ -159,7 +168,9 @@ extern "C" {
|
|||||||
} cdio_mmc_gpcmd_t;
|
} cdio_mmc_gpcmd_t;
|
||||||
|
|
||||||
|
|
||||||
/** Read Subchannel states */
|
/**
|
||||||
|
Read Subchannel states
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CDIO_MMC_READ_SUB_ST_INVALID = 0x00, /**< audio status not supported */
|
CDIO_MMC_READ_SUB_ST_INVALID = 0x00, /**< audio status not supported */
|
||||||
CDIO_MMC_READ_SUB_ST_PLAY = 0x11, /**< audio play operation in
|
CDIO_MMC_READ_SUB_ST_PLAY = 0x11, /**< audio play operation in
|
||||||
@@ -183,7 +194,9 @@ extern "C" {
|
|||||||
CDIO_MMC_READ_TYPE_M2F2 = 5 /**< mode2 sectors form2 */
|
CDIO_MMC_READ_TYPE_M2F2 = 5 /**< mode2 sectors form2 */
|
||||||
} cdio_mmc_read_cd_type_t;
|
} cdio_mmc_read_cd_type_t;
|
||||||
|
|
||||||
/** Format values for READ_TOC */
|
/**
|
||||||
|
Format values for READ_TOC
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CDIO_MMC_READTOC_FMT_TOC = 0,
|
CDIO_MMC_READTOC_FMT_TOC = 0,
|
||||||
CDIO_MMC_READTOC_FMT_SESSION = 1,
|
CDIO_MMC_READTOC_FMT_SESSION = 1,
|
||||||
@@ -193,7 +206,9 @@ extern "C" {
|
|||||||
CDIO_MMC_READTOC_FMT_CDTEXT = 5 /**< CD-TEXT info */
|
CDIO_MMC_READTOC_FMT_CDTEXT = 5 /**< CD-TEXT info */
|
||||||
} cdio_mmc_readtoc_t;
|
} cdio_mmc_readtoc_t;
|
||||||
|
|
||||||
/** Page codes for MODE SENSE and MODE SET. */
|
/**
|
||||||
|
Page codes for MODE SENSE and MODE SET.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CDIO_MMC_R_W_ERROR_PAGE = 0x01,
|
CDIO_MMC_R_W_ERROR_PAGE = 0x01,
|
||||||
CDIO_MMC_WRITE_PARMS_PAGE = 0x05,
|
CDIO_MMC_WRITE_PARMS_PAGE = 0x05,
|
||||||
@@ -216,7 +231,9 @@ PRAGMA_BEGIN_PACKED
|
|||||||
|
|
||||||
typedef struct mmc_audio_volume_entry_s mmc_audio_volume_entry_t;
|
typedef struct mmc_audio_volume_entry_s mmc_audio_volume_entry_t;
|
||||||
|
|
||||||
/** This struct is used by cdio_audio_get_volume and cdio_audio_set_volume */
|
/**
|
||||||
|
This struct is used by cdio_audio_get_volume and cdio_audio_set_volume
|
||||||
|
*/
|
||||||
struct mmc_audio_volume_s
|
struct mmc_audio_volume_s
|
||||||
{
|
{
|
||||||
mmc_audio_volume_entry_t port[4];
|
mmc_audio_volume_entry_t port[4];
|
||||||
@@ -227,7 +244,9 @@ PRAGMA_BEGIN_PACKED
|
|||||||
PRAGMA_END_PACKED
|
PRAGMA_END_PACKED
|
||||||
|
|
||||||
|
|
||||||
/** Return type codes for GET_CONFIGURATION. */
|
/**
|
||||||
|
Return type codes for GET_CONFIGURATION.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CDIO_MMC_GET_CONF_ALL_FEATURES = 0, /**< all features without regard
|
CDIO_MMC_GET_CONF_ALL_FEATURES = 0, /**< all features without regard
|
||||||
to currency. */
|
to currency. */
|
||||||
@@ -239,7 +258,9 @@ typedef enum {
|
|||||||
} cdio_mmc_get_conf_t;
|
} cdio_mmc_get_conf_t;
|
||||||
|
|
||||||
|
|
||||||
/** FEATURE codes used in GET CONFIGURATION. */
|
/**
|
||||||
|
FEATURE codes used in GET CONFIGURATION.
|
||||||
|
*/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CDIO_MMC_FEATURE_PROFILE_LIST = 0x000, /**< Profile List Feature */
|
CDIO_MMC_FEATURE_PROFILE_LIST = 0x000, /**< Profile List Feature */
|
||||||
@@ -300,7 +321,9 @@ typedef enum {
|
|||||||
report */
|
report */
|
||||||
} cdio_mmc_feature_t;
|
} cdio_mmc_feature_t;
|
||||||
|
|
||||||
/** Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */
|
/**
|
||||||
|
Profile profile codes used in GET_CONFIGURATION - PROFILE LIST.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disk, capable
|
CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disk, capable
|
||||||
of changing behavior */
|
of changing behavior */
|
||||||
@@ -348,7 +371,8 @@ typedef enum {
|
|||||||
} cdio_mmc_feature_interface_t;
|
} cdio_mmc_feature_interface_t;
|
||||||
|
|
||||||
|
|
||||||
/** The largest Command Descriptor Block (CDB) size.
|
/**
|
||||||
|
The largest Command Descriptor Block (CDB) size.
|
||||||
The possible sizes are 6, 10, and 12 bytes.
|
The possible sizes are 6, 10, and 12 bytes.
|
||||||
*/
|
*/
|
||||||
#define MAX_CDB_LEN 12
|
#define MAX_CDB_LEN 12
|
||||||
@@ -467,6 +491,10 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
Eject using MMC commands. If CD-ROM is "locked" we'll unlock it.
|
Eject using MMC commands. If CD-ROM is "locked" we'll unlock it.
|
||||||
Command is not "immediate" -- we'll wait for the command to complete.
|
Command is not "immediate" -- we'll wait for the command to complete.
|
||||||
For a more general (and lower-level) routine, @see mmc_start_stop_media.
|
For a more general (and lower-level) routine, @see mmc_start_stop_media.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return DRIVER_OP_SUCCESS (0) if we got the status.
|
||||||
|
return codes are the same as driver_return_code_t
|
||||||
*/
|
*/
|
||||||
driver_return_code_t mmc_eject_media( const CdIo_t *p_cdio );
|
driver_return_code_t mmc_eject_media( const CdIo_t *p_cdio );
|
||||||
|
|
||||||
@@ -488,19 +516,25 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
uint8_t mmc_get_cmd_len(uint8_t mmc_cmd);
|
uint8_t mmc_get_cmd_len(uint8_t mmc_cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the block size used in read requests, via MMC.
|
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
|
@return the blocksize if > 0; error if <= 0
|
||||||
*/
|
*/
|
||||||
int mmc_get_blocksize ( CdIo_t *p_cdio );
|
int mmc_get_blocksize ( CdIo_t *p_cdio );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close tray using a MMC START STOP command.
|
Close tray using a MMC START STOP command.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return DRIVER_OP_SUCCESS (0) if we got the status.
|
||||||
|
return codes are the same as driver_return_code_t
|
||||||
*/
|
*/
|
||||||
driver_return_code_t mmc_close_tray( CdIo_t *p_cdio );
|
driver_return_code_t mmc_close_tray( CdIo_t *p_cdio );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the lsn of the end of the CD
|
Get the lsn of the end of the CD
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return the lsn. On error return CDIO_INVALID_LSN.
|
@return the lsn. On error return CDIO_INVALID_LSN.
|
||||||
*/
|
*/
|
||||||
lsn_t mmc_get_disc_last_lsn( const CdIo_t *p_cdio );
|
lsn_t mmc_get_disc_last_lsn( const CdIo_t *p_cdio );
|
||||||
@@ -519,6 +553,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get drive capabilities for a device.
|
Get drive capabilities for a device.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return the drive capabilities.
|
@return the drive capabilities.
|
||||||
*/
|
*/
|
||||||
void mmc_get_drive_cap ( CdIo_t *p_cdio,
|
void mmc_get_drive_cap ( CdIo_t *p_cdio,
|
||||||
@@ -543,12 +578,13 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
/**
|
/**
|
||||||
Get the DVD type associated with cd object.
|
Get the DVD type associated with cd object.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return the DVD discmode.
|
@return the DVD discmode.
|
||||||
*/
|
*/
|
||||||
discmode_t mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,
|
discmode_t mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,
|
||||||
cdio_dvd_struct_t *s);
|
cdio_dvd_struct_t *s);
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return results of media status
|
Return results of media status
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@param out_buf media status code from operation
|
@param out_buf media status code from operation
|
||||||
@@ -557,7 +593,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
*/
|
*/
|
||||||
int mmc_get_event_status(const CdIo_t *p_cdio, uint8_t out_buf[2]);
|
int mmc_get_event_status(const CdIo_t *p_cdio, uint8_t out_buf[2]);
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Find out if media tray is open or closed.
|
Find out if media tray is open or closed.
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return 1 if media is open, 0 if closed. Error
|
@return 1 if media is open, 0 if closed. Error
|
||||||
@@ -568,6 +604,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
/**
|
/**
|
||||||
Get the CD-ROM hardware info via an MMC INQUIRY command.
|
Get the CD-ROM hardware info via an MMC INQUIRY command.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return true if we were able to get hardware info, false if we had
|
@return true if we were able to get hardware info, false if we had
|
||||||
an error.
|
an error.
|
||||||
*/
|
*/
|
||||||
@@ -586,6 +623,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
/**
|
/**
|
||||||
Get the media catalog number (MCN) from the CD via MMC.
|
Get the media catalog number (MCN) from the CD via MMC.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return the media catalog number r NULL if there is none or we
|
@return the media catalog number r NULL if there is none or we
|
||||||
don't have the ability to get it.
|
don't have the ability to get it.
|
||||||
|
|
||||||
@@ -595,9 +633,11 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
*/
|
*/
|
||||||
char * mmc_get_mcn ( const CdIo_t *p_cdio );
|
char * mmc_get_mcn ( const CdIo_t *p_cdio );
|
||||||
|
|
||||||
/** Get the output port volumes and port selections used on AUDIO PLAY
|
/**
|
||||||
|
Get the output port volumes and port selections used on AUDIO PLAY
|
||||||
commands via a MMC MODE SENSE command using the CD Audio Control
|
commands via a MMC MODE SENSE command using the CD Audio Control
|
||||||
Page.
|
Page.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
*/
|
*/
|
||||||
driver_return_code_t mmc_audio_get_volume (CdIo_t *p_cdio, /*out*/
|
driver_return_code_t mmc_audio_get_volume (CdIo_t *p_cdio, /*out*/
|
||||||
mmc_audio_volume_t *p_volume);
|
mmc_audio_volume_t *p_volume);
|
||||||
@@ -606,34 +646,42 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
Report if CD-ROM has a praticular kind of interface (ATAPI, SCSCI, ...)
|
Report if CD-ROM has a praticular kind of interface (ATAPI, SCSCI, ...)
|
||||||
Is it possible for an interface to have serveral? If not this
|
Is it possible for an interface to have serveral? If not this
|
||||||
routine could probably return the single mmc_feature_interface_t.
|
routine could probably return the single mmc_feature_interface_t.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return true if we have the interface and false if not.
|
@return true if we have the interface and false if not.
|
||||||
*/
|
*/
|
||||||
bool_3way_t mmc_have_interface( CdIo_t *p_cdio,
|
bool_3way_t mmc_have_interface( CdIo_t *p_cdio,
|
||||||
cdio_mmc_feature_interface_t e_interface );
|
cdio_mmc_feature_interface_t e_interface );
|
||||||
|
|
||||||
/** Run a MODE_SENSE command (6- or 10-byte version)
|
/**
|
||||||
|
Run a MODE_SENSE command (6- or 10-byte version)
|
||||||
and put the results in p_buf
|
and put the results in p_buf
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
||||||
*/
|
*/
|
||||||
int mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
int mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
||||||
int page);
|
int page);
|
||||||
|
|
||||||
|
|
||||||
/** Run a MODE_SENSE command (10-byte version)
|
/**
|
||||||
|
Run a MODE_SENSE command (10-byte version)
|
||||||
and put the results in p_buf
|
and put the results in p_buf
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
||||||
*/
|
*/
|
||||||
int mmc_mode_sense_10( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
int mmc_mode_sense_10( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
||||||
int page);
|
int page);
|
||||||
|
|
||||||
/** Run a MODE_SENSE command (6-byte version)
|
/**
|
||||||
|
Run a MODE_SENSE command (6-byte version)
|
||||||
and put the results in p_buf
|
and put the results in p_buf
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
||||||
*/
|
*/
|
||||||
int mmc_mode_sense_6( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
int mmc_mode_sense_6( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
||||||
int page);
|
int page);
|
||||||
|
|
||||||
/** Issue a MMC READ_CD command.
|
/**
|
||||||
|
Issue a MMC READ_CD command.
|
||||||
|
|
||||||
@param p_cdio object to read from
|
@param p_cdio object to read from
|
||||||
|
|
||||||
@@ -731,7 +779,6 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
@param i_blocksize size of the a block expected to be returned
|
@param i_blocksize size of the a block expected to be returned
|
||||||
|
|
||||||
@param i_blocks number of blocks expected to be returned.
|
@param i_blocks number of blocks expected to be returned.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_read_cd ( const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
mmc_read_cd ( const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
||||||
@@ -741,18 +788,18 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
uint8_t subchannel_selection, uint16_t i_blocksize,
|
uint8_t subchannel_selection, uint16_t i_blocksize,
|
||||||
uint32_t i_blocks );
|
uint32_t i_blocks );
|
||||||
|
|
||||||
/** Read just the user data part of some sort of data sector (via
|
/**
|
||||||
|
Read just the user data part of some sort of data sector (via
|
||||||
mmc_read_cd).
|
mmc_read_cd).
|
||||||
|
|
||||||
@param p_cdio object to read from
|
@param p_cdio object to read from
|
||||||
|
|
||||||
@param p_buf place to read data into. The caller should make sure
|
@param p_buf place to read data into. The caller should make
|
||||||
this location can store at least CDIO_CD_FRAMESIZE,
|
sure this location can store at least CDIO_CD_FRAMESIZE,
|
||||||
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on
|
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on the
|
||||||
the kind of sector getting read. If you don't know
|
kind of sector getting read. If you don't know whether
|
||||||
whether you have a Mode 1/2, Form 1/ Form 2/Formless
|
you have a Mode 1/2, Form 1/ Form 2/Formless sector best
|
||||||
sector best to reserve space for the maximum,
|
to reserve space for the maximum, M2RAW_SECTOR_SIZE.
|
||||||
M2RAW_SECTOR_SIZE.
|
|
||||||
|
|
||||||
@param i_lsn sector to read
|
@param i_lsn sector to read
|
||||||
@param i_blocksize size of each block
|
@param i_blocksize size of each block
|
||||||
@@ -764,7 +811,8 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
uint16_t i_blocksize,
|
uint16_t i_blocksize,
|
||||||
uint32_t i_blocks );
|
uint32_t i_blocks );
|
||||||
|
|
||||||
/** Read sectors using SCSI-MMC GPCMD_READ_CD.
|
/**
|
||||||
|
Read sectors using SCSI-MMC GPCMD_READ_CD.
|
||||||
Can read only up to 25 blocks.
|
Can read only up to 25 blocks.
|
||||||
*/
|
*/
|
||||||
driver_return_code_t mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf,
|
driver_return_code_t mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf,
|
||||||
@@ -817,7 +865,8 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
cdio_mmc_direction_t e_direction, unsigned int i_buf,
|
cdio_mmc_direction_t e_direction, unsigned int i_buf,
|
||||||
/*in/out*/ void *p_buf );
|
/*in/out*/ void *p_buf );
|
||||||
|
|
||||||
/** Obtain the SCSI sense reply of the most-recently-performed MMC command.
|
/**
|
||||||
|
Obtain the SCSI sense reply of the most-recently-performed MMC command.
|
||||||
These bytes give an indication of possible problems which occured in
|
These bytes give an indication of possible problems which occured in
|
||||||
the drive while the command was performed. With some commands they tell
|
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).
|
about the current state of the drive (e.g. 00h TEST UNIT READY).
|
||||||
@@ -890,7 +939,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@param b_eject eject if true and close tray if false
|
@param b_eject eject if true and close tray if false
|
||||||
@param b_immediate wait or don't wait for operation to complete
|
@param b_immediate wait or don't wait for operation to complete
|
||||||
@param power_condition Set CD-ROM to idle/standby/sleep. If nonzero
|
@param power_condition Set CD-ROM to idle/standby/sleep. If nonzero,
|
||||||
eject/load is ignored, so set to 0 if you want to eject or load.
|
eject/load is ignored, so set to 0 if you want to eject or load.
|
||||||
|
|
||||||
@see mmc_eject_media or mmc_close_tray
|
@see mmc_eject_media or mmc_close_tray
|
||||||
@@ -903,7 +952,8 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
|
|||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/** The below variables are trickery to force the above enum symbol
|
/**
|
||||||
|
The below variables are trickery to force the above enum symbol
|
||||||
values to be recorded in debug symbol tables. They are used to
|
values to be recorded in debug symbol tables. They are used to
|
||||||
allow one to refer to the enumeration value names in the typedefs
|
allow one to refer to the enumeration value names in the typedefs
|
||||||
above in a debugger and debugger expressions
|
above in a debugger and debugger expressions
|
||||||
|
|||||||
301
lib/driver/mmc.c
301
lib/driver/mmc.c
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
$Id: mmc.c,v 1.40 2008/05/09 09:54:39 edsdead Exp $
|
$Id: mmc.c,v 1.40 2008/05/09 09:54:39 edsdead Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010
|
||||||
|
Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -67,15 +68,19 @@ cdio_mmc_mode_page_t debug_cdio_mmc_mode_page;
|
|||||||
corresponding publically-accessible routine.
|
corresponding publically-accessible routine.
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/*! The maximum value in milliseconds that we will wait on an MMC
|
/**
|
||||||
command. */
|
The maximum value in milliseconds that we will wait on an MMC
|
||||||
|
command.
|
||||||
|
*/
|
||||||
uint32_t mmc_timeout_ms = MMC_TIMEOUT_DEFAULT;
|
uint32_t mmc_timeout_ms = MMC_TIMEOUT_DEFAULT;
|
||||||
|
|
||||||
/*! The maximum value in milliseconds that we will wait on an MMC read
|
/**
|
||||||
command. */
|
The maximum value in milliseconds that we will wait on an MMC read
|
||||||
|
command.
|
||||||
|
*/
|
||||||
uint32_t mmc_read_timeout_ms = MMC_READ_TIMEOUT_DEFAULT;
|
uint32_t mmc_read_timeout_ms = MMC_READ_TIMEOUT_DEFAULT;
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Read Audio Subchannel information
|
Read Audio Subchannel information
|
||||||
|
|
||||||
@param p_user_data the CD object to be acted upon.
|
@param p_user_data the CD object to be acted upon.
|
||||||
@@ -113,7 +118,7 @@ const char *mmc_audio_state2str( uint8_t i_audio_state )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Get the block size for subsequest read requests, via MMC.
|
Get the block size for subsequest read requests, via MMC.
|
||||||
@return the blocksize if > 0; error if <= 0
|
@return the blocksize if > 0; error if <= 0
|
||||||
*/
|
*/
|
||||||
@@ -125,10 +130,8 @@ get_blocksize_mmc (void *p_user_data)
|
|||||||
return mmc_get_blocksize(p_env->cdio);
|
return mmc_get_blocksize(p_env->cdio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Get the lsn of the end of the CD (via MMC).
|
Get the lsn of the end of the CD (via MMC).
|
||||||
|
|
||||||
@return the lsn. On error return CDIO_INVALID_LSN.
|
|
||||||
*/
|
*/
|
||||||
lsn_t
|
lsn_t
|
||||||
get_disc_last_lsn_mmc (void *p_user_data)
|
get_disc_last_lsn_mmc (void *p_user_data)
|
||||||
@@ -149,7 +152,8 @@ get_drive_cap_mmc (const void *p_user_data,
|
|||||||
p_read_cap, p_write_cap, p_misc_cap );
|
p_read_cap, p_write_cap, p_misc_cap );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Find out if media has changed since the last call. @param
|
/**
|
||||||
|
Find out if media has changed since the last call. @param
|
||||||
p_user_data the environment of the CD object to be acted upon.
|
p_user_data the environment of the CD object to be acted upon.
|
||||||
@return 1 if media has changed since last call, 0 if not. Error
|
@return 1 if media has changed since last call, 0 if not. Error
|
||||||
return codes are the same as driver_return_code_t
|
return codes are the same as driver_return_code_t
|
||||||
@@ -188,7 +192,9 @@ read_data_sectors_mmc ( void *p_user_data, void *p_buf,
|
|||||||
i_blocks );
|
i_blocks );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set read blocksize (via MMC) */
|
/**
|
||||||
|
Set read blocksize (via MMC)
|
||||||
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
set_blocksize_mmc (void *p_user_data, uint16_t i_blocksize)
|
set_blocksize_mmc (void *p_user_data, uint16_t i_blocksize)
|
||||||
{
|
{
|
||||||
@@ -197,8 +203,9 @@ set_blocksize_mmc (void *p_user_data, uint16_t i_blocksize)
|
|||||||
return mmc_set_blocksize(p_env->cdio, i_blocksize);
|
return mmc_set_blocksize(p_env->cdio, i_blocksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the drive speed Set the drive speed in K bytes per second. (via
|
/** Set the drive speed Set the drive speed in K bytes per second. (via
|
||||||
MMC). */
|
MMC).
|
||||||
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
set_speed_mmc (void *p_user_data, int i_speed)
|
set_speed_mmc (void *p_user_data, int i_speed)
|
||||||
{
|
{
|
||||||
@@ -207,7 +214,9 @@ set_speed_mmc (void *p_user_data, int i_speed)
|
|||||||
return mmc_set_speed( p_env->cdio, i_speed );
|
return mmc_set_speed( p_env->cdio, i_speed );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the drive speed in CD-ROM speed units (via MMC). */
|
/**
|
||||||
|
Set the drive speed in CD-ROM speed units (via MMC).
|
||||||
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
set_drive_speed_mmc (void *p_user_data, int i_Kbs_speed)
|
set_drive_speed_mmc (void *p_user_data, int i_Kbs_speed)
|
||||||
{
|
{
|
||||||
@@ -216,7 +225,8 @@ set_drive_speed_mmc (void *p_user_data, int i_Kbs_speed)
|
|||||||
return mmc_set_drive_speed( p_env->cdio, i_Kbs_speed );
|
return mmc_set_drive_speed( p_env->cdio, i_Kbs_speed );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the output port volumes and port selections used on AUDIO PLAY
|
/**
|
||||||
|
Get the output port volumes and port selections used on AUDIO PLAY
|
||||||
commands via a MMC MODE SENSE command using the CD Audio Control
|
commands via a MMC MODE SENSE command using the CD Audio Control
|
||||||
Page.
|
Page.
|
||||||
*/
|
*/
|
||||||
@@ -240,7 +250,7 @@ mmc_audio_get_volume( CdIo_t *p_cdio, /*out*/ mmc_audio_volume_t *p_volume )
|
|||||||
return i_rc;
|
return i_rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
On input a MODE_SENSE command was issued and we have the results
|
On input a MODE_SENSE command was issued and we have the results
|
||||||
in p. We interpret this and return a bit mask set according to the
|
in p. We interpret this and return a bit mask set according to the
|
||||||
capabilities.
|
capabilities.
|
||||||
@@ -278,7 +288,7 @@ mmc_get_drive_cap_buf(const uint8_t *p,
|
|||||||
*p_misc_cap |= CDIO_DRIVE_CAP_MISC_CLOSE_TRAY;
|
*p_misc_cap |= CDIO_DRIVE_CAP_MISC_CLOSE_TRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Get the DVD type associated with cd object.
|
Get the DVD type associated with cd object.
|
||||||
*/
|
*/
|
||||||
discmode_t
|
discmode_t
|
||||||
@@ -336,7 +346,7 @@ mmc_get_dvd_struct_physical_private ( void *p_env,
|
|||||||
return DRIVER_OP_SUCCESS;
|
return DRIVER_OP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return the media catalog number MCN.
|
Return the media catalog number MCN.
|
||||||
|
|
||||||
Note: string is malloc'd so caller should free() then returned
|
Note: string is malloc'd so caller should free() then returned
|
||||||
@@ -372,7 +382,8 @@ mmc_get_mcn_private ( void *p_env,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run a MODE SENSE command (either the 6- or 10-byte version
|
/**
|
||||||
|
Run a MODE SENSE command (either the 6- or 10-byte version
|
||||||
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@@ -389,7 +400,8 @@ mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
|
|||||||
return mmc_mode_sense_10(p_cdio, p_buf, i_size, page);
|
return mmc_mode_sense_10(p_cdio, p_buf, i_size, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Run a MODE_SENSE command (6-byte version)
|
/**
|
||||||
|
Run a MODE_SENSE command (6-byte version)
|
||||||
and put the results in p_buf
|
and put the results in p_buf
|
||||||
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
||||||
*/
|
*/
|
||||||
@@ -415,7 +427,8 @@ mmc_mode_sense_6( CdIo_t *p_cdio, void *p_buf, int i_size, int page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Run a MODE_SENSE command (10-byte version)
|
/**
|
||||||
|
Run a MODE_SENSE command (10-byte version)
|
||||||
and put the results in p_buf
|
and put the results in p_buf
|
||||||
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
@return DRIVER_OP_SUCCESS if we ran the command ok.
|
||||||
*/
|
*/
|
||||||
@@ -441,7 +454,7 @@ mmc_mode_sense_10( CdIo_t *p_cdio, void *p_buf, int i_size, int page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Read cdtext information for a CdIo_t object .
|
Read cdtext information for a CdIo_t object .
|
||||||
|
|
||||||
return true on success, false on error or CD-Text information does
|
return true on success, false on error or CD-Text information does
|
||||||
@@ -554,7 +567,7 @@ mmc_set_blocksize_private ( void *p_env,
|
|||||||
/***********************************************************
|
/***********************************************************
|
||||||
User-accessible Operations.
|
User-accessible Operations.
|
||||||
************************************************************/
|
************************************************************/
|
||||||
/*!
|
/**
|
||||||
Return the number of length in bytes of the Command Descriptor
|
Return the number of length in bytes of the Command Descriptor
|
||||||
buffer (CDB) for a given MMC command. The length will be
|
buffer (CDB) for a given MMC command. The length will be
|
||||||
either 6, 10, or 12.
|
either 6, 10, or 12.
|
||||||
@@ -566,8 +579,9 @@ mmc_get_cmd_len(uint8_t scsi_cmd)
|
|||||||
return scsi_cdblen[((scsi_cmd >> 5) & 7)];
|
return scsi_cdblen[((scsi_cmd >> 5) & 7)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return the size of the CD in logical block address (LBA) units.
|
Return the size of the CD in logical block address (LBA) units.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return the lsn. On error 0 or CDIO_INVALD_LSN.
|
@return the lsn. On error 0 or CDIO_INVALD_LSN.
|
||||||
*/
|
*/
|
||||||
lsn_t
|
lsn_t
|
||||||
@@ -607,11 +621,10 @@ mmc_get_disc_last_lsn ( const CdIo_t *p_cdio )
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Read Audio Subchannel information
|
Read Audio Subchannel information
|
||||||
|
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
|
mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
|
||||||
@@ -653,7 +666,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
|
|||||||
return i_rc;
|
return i_rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return the discmode as reported by the SCSI-MMC Read (FULL) TOC
|
Return the discmode as reported by the SCSI-MMC Read (FULL) TOC
|
||||||
command.
|
command.
|
||||||
|
|
||||||
@@ -693,6 +706,11 @@ mmc_get_discmode( const CdIo_t *p_cdio )
|
|||||||
return CDIO_DISC_MODE_NO_INFO;
|
return CDIO_DISC_MODE_NO_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get drive capabilities for a device.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return the drive capabilities.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
mmc_get_drive_cap (CdIo_t *p_cdio,
|
mmc_get_drive_cap (CdIo_t *p_cdio,
|
||||||
/*out*/ cdio_drive_read_cap_t *p_read_cap,
|
/*out*/ cdio_drive_read_cap_t *p_read_cap,
|
||||||
@@ -765,7 +783,7 @@ mmc_get_drive_cap (CdIo_t *p_cdio,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Get the MMC level supported by the device.
|
Get the MMC level supported by the device.
|
||||||
*/
|
*/
|
||||||
cdio_mmc_level_t
|
cdio_mmc_level_t
|
||||||
@@ -795,8 +813,11 @@ mmc_get_drive_mmc_cap(CdIo_t *p_cdio)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Get the DVD type associated with cd object.
|
Get the DVD type associated with cd object.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return the DVD discmode.
|
||||||
*/
|
*/
|
||||||
discmode_t
|
discmode_t
|
||||||
mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
|
mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
|
||||||
@@ -808,9 +829,13 @@ mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio, cdio_dvd_struct_t *s)
|
|||||||
s);
|
s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Get the CD-ROM hardware info via a MMC INQUIRY command.
|
Get the CD-ROM hardware info via a MMC INQUIRY command.
|
||||||
False is returned if we had an error getting the information.
|
False is returned if we had an error getting the information.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return true if we were able to get hardware info, false if we had
|
||||||
|
an error.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
mmc_get_hwinfo ( const CdIo_t *p_cdio,
|
mmc_get_hwinfo ( const CdIo_t *p_cdio,
|
||||||
@@ -847,7 +872,7 @@ mmc_get_hwinfo ( const CdIo_t *p_cdio,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return results of media status
|
Return results of media status
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return DRIVER_OP_SUCCESS (0) if we got the status.
|
@return DRIVER_OP_SUCCESS (0) if we got the status.
|
||||||
@@ -882,7 +907,7 @@ int mmc_get_event_status(const CdIo_t *p_cdio, uint8_t out_buf[2])
|
|||||||
return DRIVER_OP_ERROR;
|
return DRIVER_OP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Find out if media has changed since the last call.
|
Find out if media has changed since the last call.
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return 1 if media has changed since last call, 0 if not. Error
|
@return 1 if media has changed since last call, 0 if not. Error
|
||||||
@@ -899,6 +924,17 @@ int mmc_get_media_changed(const CdIo_t *p_cdio)
|
|||||||
return (status_buf[0] & 0x02) ? 1 : 0;
|
return (status_buf[0] & 0x02) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the media catalog number (MCN) from the CD via MMC.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@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.
|
||||||
|
|
||||||
|
*/
|
||||||
char *
|
char *
|
||||||
mmc_get_mcn ( const CdIo_t *p_cdio )
|
mmc_get_mcn ( const CdIo_t *p_cdio )
|
||||||
{
|
{
|
||||||
@@ -906,7 +942,7 @@ mmc_get_mcn ( const CdIo_t *p_cdio )
|
|||||||
return mmc_get_mcn_private (p_cdio->env, p_cdio->op.run_mmc_cmd );
|
return mmc_get_mcn_private (p_cdio->env, p_cdio->op.run_mmc_cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Find out if media tray is open or closed.
|
Find out if media tray is open or closed.
|
||||||
@param p_cdio the CD object to be acted upon.
|
@param p_cdio the CD object to be acted upon.
|
||||||
@return 1 if media is open, 0 if closed. Error
|
@return 1 if media is open, 0 if closed. Error
|
||||||
@@ -923,18 +959,19 @@ int mmc_get_tray_status(const CdIo_t *p_cdio)
|
|||||||
return (status_buf[1] & 0x01) ? 1 : 0;
|
return (status_buf[1] & 0x01) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Run a MMC command.
|
Run a MMC command.
|
||||||
|
|
||||||
cdio CD structure set by cdio_open().
|
@param cdio CD structure set by cdio_open().
|
||||||
i_timeout time in milliseconds we will wait for the command
|
@param i_timeout time in milliseconds we will wait for the command
|
||||||
to complete. If this value is -1, use the default
|
to complete. If this value is -1, use the default
|
||||||
time-out value.
|
time-out value.
|
||||||
buf Buffer for data, both sending and receiving
|
@param buf Buffer for data, both sending and receiving
|
||||||
len Size of buffer
|
@param len Size of buffer
|
||||||
e_direction direction the transfer is to go
|
@param e_direction direction the transfer is to go
|
||||||
cdb CDB bytes. All values that are needed should be set on
|
@param cdb CDB bytes. All values that are needed should be set on
|
||||||
input. We'll figure out what the right CDB length should be.
|
input. We'll figure out what the right CDB length
|
||||||
|
should be.
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
||||||
@@ -950,6 +987,25 @@ mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Added by SukkoPera to allow CDB length to be specified manually */
|
/* Added by SukkoPera to allow CDB length to be specified manually */
|
||||||
|
/**
|
||||||
|
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.
|
||||||
|
|
||||||
|
@param p_cdio CD structure set by cdio_open().
|
||||||
|
@param i_timeout_ms time in milliseconds we will wait for the command
|
||||||
|
to complete.
|
||||||
|
@param p_cdb CDB bytes. All values that are needed should be set
|
||||||
|
on input.
|
||||||
|
@param i_cdb number of CDB bytes.
|
||||||
|
@param e_direction direction the transfer is to go.
|
||||||
|
@param i_buf Size of buffer
|
||||||
|
@param p_buf Buffer for data, both sending and receiving.
|
||||||
|
|
||||||
|
@return 0 if command completed successfully.
|
||||||
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
||||||
const mmc_cdb_t *p_cdb, unsigned int i_cdb,
|
const mmc_cdb_t *p_cdb, unsigned int i_cdb,
|
||||||
@@ -964,6 +1020,22 @@ mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Added in version 0.83 by scdbackup */
|
/* Added in version 0.83 by scdbackup */
|
||||||
|
/**
|
||||||
|
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).
|
||||||
|
@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.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
mmc_last_cmd_sense( const CdIo_t *p_cdio, unsigned char **sense)
|
mmc_last_cmd_sense( const CdIo_t *p_cdio, unsigned char **sense)
|
||||||
{
|
{
|
||||||
@@ -982,8 +1054,12 @@ mmc_last_cmd_sense( const CdIo_t *p_cdio, unsigned char **sense)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Return the byte size returned on a MMC READ command (e.g. READ_10,
|
/**
|
||||||
READ_MSF, ..)
|
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
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
mmc_get_blocksize ( CdIo_t *p_cdio)
|
mmc_get_blocksize ( CdIo_t *p_cdio)
|
||||||
@@ -1024,9 +1100,16 @@ mmc_get_blocksize ( CdIo_t *p_cdio)
|
|||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Load or Unload media using a MMC START STOP command.
|
||||||
|
|
||||||
/*!
|
@param p_cdio the CD object to be acted upon.
|
||||||
* Load or Unload media using a MMC START STOP command.
|
@param b_eject eject if true and close tray if false
|
||||||
|
@param b_immediate wait or don't wait for operation to complete
|
||||||
|
@param power_condition Set CD-ROM to idle/standby/sleep. If nonzero,
|
||||||
|
eject/load is ignored, so set to 0 if you want to eject or load.
|
||||||
|
|
||||||
|
@see mmc_eject_media or mmc_close_tray
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_start_stop_media(const CdIo_t *p_cdio, bool b_eject, bool b_immediate,
|
mmc_start_stop_media(const CdIo_t *p_cdio, bool b_eject, bool b_immediate,
|
||||||
@@ -1057,7 +1140,10 @@ mmc_start_stop_media(const CdIo_t *p_cdio, bool b_eject, bool b_immediate,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close tray using a MMC START STOP command.
|
Close tray using a MMC START STOP command.
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return DRIVER_OP_SUCCESS (0) if we got the status.
|
||||||
|
return codes are the same as driver_return_code_t
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_close_tray( CdIo_t *p_cdio )
|
mmc_close_tray( CdIo_t *p_cdio )
|
||||||
@@ -1069,10 +1155,14 @@ mmc_close_tray( CdIo_t *p_cdio )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Eject using MMC commands. If CD-ROM is "locked" we'll unlock it.
|
Eject using MMC commands. If CD-ROM is "locked" we'll unlock it.
|
||||||
Command is not "immediate" -- we'll wait for the command to complete.
|
Command is not "immediate" -- we'll wait for the command to complete.
|
||||||
For a more general (and lower-level) routine, @see mmc_start_stop_media.
|
For a more general (and lower-level) routine, @see mmc_start_stop_media.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
@return DRIVER_OP_SUCCESS (0) if we got the status.
|
||||||
|
return codes are the same as driver_return_code_t
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_eject_media( const CdIo_t *p_cdio )
|
mmc_eject_media( const CdIo_t *p_cdio )
|
||||||
@@ -1095,7 +1185,7 @@ mmc_eject_media( const CdIo_t *p_cdio )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return a string containing the name of the given feature
|
Return a string containing the name of the given feature
|
||||||
*/
|
*/
|
||||||
const char *mmc_feature2str( int i_feature )
|
const char *mmc_feature2str( int i_feature )
|
||||||
@@ -1187,7 +1277,7 @@ const char *mmc_feature2str( int i_feature )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
Return a string containing the name of the given feature profile.
|
Return a string containing the name of the given feature profile.
|
||||||
*/
|
*/
|
||||||
const char *mmc_feature_profile2str( int i_feature_profile )
|
const char *mmc_feature_profile2str( int i_feature_profile )
|
||||||
@@ -1245,9 +1335,9 @@ const char *mmc_feature_profile2str( int i_feature_profile )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
* See if CD-ROM has feature with value value
|
See if CD-ROM has feature with value value
|
||||||
* @return true if we have the feature and false if not.
|
@return true if we have the feature and false if not.
|
||||||
*/
|
*/
|
||||||
bool_3way_t
|
bool_3way_t
|
||||||
mmc_have_interface( CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface )
|
mmc_have_interface( CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface )
|
||||||
@@ -1297,7 +1387,104 @@ mmc_have_interface( CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface )
|
|||||||
#define MAX_CD_READ_BLOCKS 16
|
#define MAX_CD_READ_BLOCKS 16
|
||||||
#define CD_READ_TIMEOUT_MS mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2)
|
#define CD_READ_TIMEOUT_MS mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2)
|
||||||
|
|
||||||
/*! issue a MMC READ_CD command.
|
/**
|
||||||
|
Issue a MMC READ_CD command.
|
||||||
|
|
||||||
|
@param p_cdio object to read from
|
||||||
|
|
||||||
|
@param p_buf Place to store data. The caller should ensure that
|
||||||
|
p_buf can hold at least i_blocksize * i_blocks bytes.
|
||||||
|
|
||||||
|
@param i_lsn sector to read
|
||||||
|
|
||||||
|
@param expected_sector_type restricts reading to a specific CD
|
||||||
|
sector type. Only 3 bits with values 1-5 are used:
|
||||||
|
0 all sector types
|
||||||
|
1 CD-DA sectors only
|
||||||
|
2 Mode 1 sectors only
|
||||||
|
3 Mode 2 formless sectors only. Note in contrast to all other
|
||||||
|
values an MMC CD-ROM is not required to support this mode.
|
||||||
|
4 Mode 2 Form 1 sectors only
|
||||||
|
5 Mode 2 Form 2 sectors only
|
||||||
|
|
||||||
|
@param b_digital_audio_play Control error concealment when the
|
||||||
|
data being read is CD-DA. If the data being read is not CD-DA,
|
||||||
|
this parameter is ignored. If the data being read is CD-DA and
|
||||||
|
DAP is false zero, then the user data returned should not be
|
||||||
|
modified by flaw obscuring mechanisms such as audio data mute and
|
||||||
|
interpolate. If the data being read is CD-DA and DAP is true,
|
||||||
|
then the user data returned should be modified by flaw obscuring
|
||||||
|
mechanisms such as audio data mute and interpolate.
|
||||||
|
|
||||||
|
b_sync_header return the sync header (which will probably have
|
||||||
|
the same value as CDIO_SECTOR_SYNC_HEADER of size
|
||||||
|
CDIO_CD_SYNC_SIZE).
|
||||||
|
|
||||||
|
@param header_codes Header Codes refer to the sector header and
|
||||||
|
the sub-header that is present in mode 2 formed sectors:
|
||||||
|
|
||||||
|
0 No header information is returned.
|
||||||
|
1 The 4-byte sector header of data sectors is be returned,
|
||||||
|
2 The 8-byte sector sub-header of mode 2 formed sectors is
|
||||||
|
returned.
|
||||||
|
3 Both sector header and sub-header (12 bytes) is returned.
|
||||||
|
The Header preceeds the rest of the bytes (e.g. user-data bytes)
|
||||||
|
that might get returned.
|
||||||
|
|
||||||
|
@param b_user_data Return user data if true.
|
||||||
|
|
||||||
|
For CD-DA, the User Data is CDIO_CD_FRAMESIZE_RAW bytes.
|
||||||
|
|
||||||
|
For Mode 1, The User Data is ISO_BLOCKSIZE bytes beginning at
|
||||||
|
offset CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE.
|
||||||
|
|
||||||
|
For Mode 2 formless, The User Data is M2RAW_SECTOR_SIZE bytes
|
||||||
|
beginning at offset CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE.
|
||||||
|
|
||||||
|
For data Mode 2, form 1, User Data is ISO_BLOCKSIZE bytes beginning at
|
||||||
|
offset CDIO_CD_XA_SYNC_HEADER.
|
||||||
|
|
||||||
|
For data Mode 2, form 2, User Data is 2 324 bytes beginning at
|
||||||
|
offset CDIO_CD_XA_SYNC_HEADER.
|
||||||
|
|
||||||
|
@param b_sync
|
||||||
|
|
||||||
|
@param b_edc_ecc true if we return EDC/ECC error detection/correction bits.
|
||||||
|
|
||||||
|
The presence and size of EDC redundancy or ECC parity is defined
|
||||||
|
according to sector type:
|
||||||
|
|
||||||
|
CD-DA sectors have neither EDC redundancy nor ECC parity.
|
||||||
|
|
||||||
|
Data Mode 1 sectors have 288 bytes of EDC redundancy, Pad, and
|
||||||
|
ECC parity beginning at offset 2064.
|
||||||
|
|
||||||
|
Data Mode 2 formless sectors have neither EDC redundancy nor ECC
|
||||||
|
parity
|
||||||
|
|
||||||
|
Data Mode 2 form 1 sectors have 280 bytes of EDC redundancy and
|
||||||
|
ECC parity beginning at offset 2072
|
||||||
|
|
||||||
|
Data Mode 2 form 2 sectors optionally have 4 bytes of EDC
|
||||||
|
redundancy beginning at offset 2348.
|
||||||
|
|
||||||
|
@param c2_error_information If true associate a bit with each
|
||||||
|
sector for C2 error The resulting bit field is ordered exactly as
|
||||||
|
the main channel bytes. Each 8-bit boundary defines a byte of
|
||||||
|
flag bits.
|
||||||
|
|
||||||
|
@param subchannel_selection subchannel-selection bits
|
||||||
|
|
||||||
|
0 No Sub-channel data shall be returned. (0 bytes)
|
||||||
|
1 RAW P-W Sub-channel data shall be returned. (96 byte)
|
||||||
|
2 Formatted Q sub-channel data shall be transferred (16 bytes)
|
||||||
|
3 Reserved
|
||||||
|
4 Corrected and de-interleaved R-W sub-channel (96 bytes)
|
||||||
|
5-7 Reserved
|
||||||
|
|
||||||
|
@param i_blocksize size of the a block expected to be returned
|
||||||
|
|
||||||
|
@param i_blocks number of blocks expected to be returned.
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_read_cd ( const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
mmc_read_cd ( const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
||||||
@@ -1357,7 +1544,8 @@ mmc_read_cd ( const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Read sectors using SCSI-MMC GPCMD_READ_CD.
|
/**
|
||||||
|
Read sectors using SCSI-MMC GPCMD_READ_CD.
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_read_data_sectors ( CdIo_t *p_cdio, void *p_buf,
|
mmc_read_data_sectors ( CdIo_t *p_cdio, void *p_buf,
|
||||||
@@ -1380,7 +1568,8 @@ mmc_read_data_sectors ( CdIo_t *p_cdio, void *p_buf,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Read sectors using SCSI-MMC GPCMD_READ_CD.
|
/**
|
||||||
|
Read sectors using SCSI-MMC GPCMD_READ_CD.
|
||||||
Can read only up to 25 blocks.
|
Can read only up to 25 blocks.
|
||||||
*/
|
*/
|
||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ main(int argc, const char *argv[])
|
|||||||
if (psz_device)
|
if (psz_device)
|
||||||
free(psz_device);
|
free(psz_device);
|
||||||
else {
|
else {
|
||||||
/* Unless we do the chdir, will fail. So don't set as an error. */
|
/* Unless we do the chdir, will fail. So don't set as an
|
||||||
|
* error. */
|
||||||
printf("Can't get default device\n");
|
printf("Can't get default device\n");
|
||||||
}
|
}
|
||||||
drc = cdio_set_speed(p_cdio, 5);
|
drc = cdio_set_speed(p_cdio, 5);
|
||||||
|
|||||||
Reference in New Issue
Block a user