Try to regularize naming better. More mmc_ -> cdio_mmc_

Add more debug variables to be able to get at enum values in a debugger.
This commit is contained in:
rocky
2005-10-21 11:13:54 +00:00
parent 4e67d2192a
commit fa0848bf90
5 changed files with 65 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: mmc.h,v 1.21 2005/06/26 18:29:49 rocky Exp $ $Id: mmc.h,v 1.22 2005/10/21 11:13:54 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -52,10 +52,8 @@ extern "C" {
#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
descriptor and those that in in 12 take a 12-byte descriptor. descriptor and those that in in 12 take a 12-byte descriptor.
@@ -176,7 +174,7 @@ extern "C" {
CDIO_MMC_READ_SUB_ST_NO_STATUS = 0x15, /**< no current audio status to CDIO_MMC_READ_SUB_ST_NO_STATUS = 0x15, /**< no current audio status to
return */ return */
} cdio_mmc_read_sub_state_t; } cdio_mmc_read_sub_state_t;
/*! Level values that can go into READ_CD */ /*! Level values that can go into READ_CD */
#define CDIO_MMC_READ_TYPE_ANY 0 /**< All types */ #define CDIO_MMC_READ_TYPE_ANY 0 /**< All types */
#define CDIO_MMC_READ_TYPE_CDDA 1 /**< Only CD-DA sectors */ #define CDIO_MMC_READ_TYPE_CDDA 1 /**< Only CD-DA sectors */
@@ -293,7 +291,7 @@ typedef enum {
identifier. */ identifier. */
CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date CDIO_MMC_FEATURE_FIRMWARE_DATE = 0x1FF, /**< Firmware creation date
report */ report */
} 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 {
@@ -331,7 +329,7 @@ typedef enum {
double layer */ double layer */
CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not
conform to any Profile. */ conform to any Profile. */
} mmc_feature_profile_t; } cdio_mmc_feature_profile_t;
typedef enum { typedef enum {
CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED = 0, CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED = 0,
@@ -340,7 +338,7 @@ typedef enum {
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394 = 3, CDIO_MMC_FEATURE_INTERFACE_IEEE_1394 = 3,
CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A = 4, CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A = 4,
CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH = 5 CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH = 5
} mmc_feature_interface_t; } cdio_mmc_feature_interface_t;
/*! The largest Command Descriptor Block (CDB) size. /*! The largest Command Descriptor Block (CDB) size.
@@ -367,7 +365,7 @@ typedef struct mmc_cdb_s {
unsigned char reserved2; unsigned char reserved2;
unsigned char profile_msb; unsigned char profile_msb;
unsigned char profile_lsb; unsigned char profile_lsb;
} mmc_feature_list_header_t; } cdio_mmc_feature_list_header_t;
/*! An enumeration indicating whether an MMC command is sending /*! An enumeration indicating whether an MMC command is sending
data or getting data. data or getting data.
@@ -375,21 +373,21 @@ typedef struct mmc_cdb_s {
typedef enum mmc_direction_s { typedef enum mmc_direction_s {
SCSI_MMC_DATA_READ, SCSI_MMC_DATA_READ,
SCSI_MMC_DATA_WRITE SCSI_MMC_DATA_WRITE
} mmc_direction_t; } cdio_mmc_direction_t;
typedef struct mmc_subchannel_s typedef struct mmc_subchannel_s
{ {
uint8_t reserved; uint8_t reserved;
uint8_t audio_status; uint8_t audio_status;
uint16_t data_length; /* Really 7.2.2 */ uint16_t data_length; /**< Really ISO 9660 7.2.2 */
uint8_t format; uint8_t format;
uint8_t address: 4; uint8_t address: 4;
uint8_t control: 4; uint8_t control: 4;
uint8_t track; uint8_t track;
uint8_t index; uint8_t index;
uint8_t abs_addr[4]; uint8_t abs_addr[4];
uint8_t rel_addr[4]; uint8_t rel_addr[4];
} mmc_subchannel_t; } cdio_mmc_subchannel_t;
#define CDIO_MMC_SET_COMMAND(cdb, command) \ #define CDIO_MMC_SET_COMMAND(cdb, command) \
cdb[0] = command cdb[0] = command
@@ -580,7 +578,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
@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,
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
@@ -758,7 +756,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
*/ */
int mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms, int mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms,
const mmc_cdb_t *p_cdb, const mmc_cdb_t *p_cdb,
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 );
/*! /*!
Set the block size for subsequest read requests, via MMC. Set the block size for subsequest read requests, via MMC.
@@ -790,7 +788,21 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio,
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/** 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 refer to the enumeration value names in the typedefs
above in a debugger and debugger expressions
*/
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_feature_t debug_cdio_mmc_feature;
extern cdio_mmc_feature_profile_t debug_cdio_mmc_feature_profile;
extern cdio_mmc_feature_interface_t debug_cdio_mmc_feature_interface;
/** For backward compatibility. */ /** For backward compatibility. */
#define mmc_direction_t cdio_mmc_direction_t
#define mmc_feature_interface_t cdio_mmc_feature_interface_t
#define mmc_subchannel_t cdio_mmc_subchannel_t
#define scsi_mmc_cdb_t mmc_cdb_t #define scsi_mmc_cdb_t mmc_cdb_t
#define scsi_mmc_direction_t mmc_direction_t #define scsi_mmc_direction_t mmc_direction_t
#define scsi_mmc_get_cmd_len mmc_get_cmd_len #define scsi_mmc_get_cmd_len mmc_get_cmd_len

View File

@@ -1,5 +1,5 @@
/* /*
$Id: gnu_linux.c,v 1.17 2005/07/23 22:05:29 rocky Exp $ $Id: gnu_linux.c,v 1.18 2005/10/21 11:13:54 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: gnu_linux.c,v 1.17 2005/07/23 22:05:29 rocky Exp $"; static const char _rcsid[] = "$Id: gnu_linux.c,v 1.18 2005/10/21 11:13:54 rocky Exp $";
#include <string.h> #include <string.h>
@@ -100,13 +100,14 @@ typedef struct {
/**** prototypes for static functions ****/ /**** prototypes for static functions ****/
static bool is_cdrom_linux(const char *drive, char *mnttype); static bool is_cdrom_linux(const char *drive, char *mnttype);
static bool read_toc_linux (void *p_user_data); static bool read_toc_linux (void *p_user_data);
static driver_return_code_t run_mmc_cmd_linux( void *p_user_data, static driver_return_code_t
unsigned int i_timeout, run_mmc_cmd_linux( void *p_user_data,
unsigned int i_cdb, unsigned int i_timeout,
const mmc_cdb_t *p_cdb, unsigned int i_cdb,
mmc_direction_t e_direction, const mmc_cdb_t *p_cdb,
unsigned int i_buf, cdio_mmc_direction_t e_direction,
/*in/out*/ void *p_buf ); unsigned int i_buf,
/*in/out*/ void *p_buf );
static access_mode_t static access_mode_t
str_to_access_mode_linux(const char *psz_access_mode) str_to_access_mode_linux(const char *psz_access_mode)
@@ -1104,7 +1105,7 @@ static driver_return_code_t
run_mmc_cmd_linux( void *p_user_data, run_mmc_cmd_linux( void *p_user_data,
unsigned int i_timeout_ms, unsigned int i_timeout_ms,
unsigned int i_cdb, const mmc_cdb_t *p_cdb, unsigned int i_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction, cdio_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf ) unsigned int i_buf, /*in/out*/ void *p_buf )
{ {
const _img_private_t *p_env = p_user_data; const _img_private_t *p_env = p_user_data;

View File

@@ -162,6 +162,11 @@ cdtext_get_const
cdtext_init cdtext_init
cdtext_is_keyword cdtext_is_keyword
cdtext_set cdtext_set
debug_cdio_mmc_gpcmd_t
debug_cdio_mmc_read_sub_state_t
debug_cdio_mmc_feature_t
debug_cdio_mmc_feature_profile_t
debug_cdio_mmc_feature_interface_t
discmode2str discmode2str
mmc_audio_read_subchannel mmc_audio_read_subchannel
mmc_audio_state2str mmc_audio_state2str

View File

@@ -1,6 +1,6 @@
/* Common Multimedia Command (MMC) routines. /* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.27 2005/06/26 18:29:49 rocky Exp $ $Id: mmc.c,v 1.28 2005/10/21 11:13:54 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -45,6 +45,17 @@
#include <errno.h> #include <errno.h>
#endif #endif
/** 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 refer to the enumeration value names in the typedefs
above in a debugger and debugger expressions
*/
cdio_mmc_gpcmd_t debug_cdio_mmc_gpcmd;
cdio_mmc_read_sub_state_t debug_cdio_mmc_read_sub_state;
cdio_mmc_feature_t debug_cdio_mmc_feature;
cdio_mmc_feature_profile_t debug_cdio_mmc_feature_profile;
cdio_mmc_feature_interface_t debug_cdio_mmc_feature_interface;
/************************************************************************* /*************************************************************************
MMC CdIo Operations which a driver may use. MMC CdIo Operations which a driver may use.
These are not accessible directly. These are not accessible directly.
@@ -587,7 +598,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
{ {
mmc_cdb_t cdb; mmc_cdb_t cdb;
driver_return_code_t i_rc; driver_return_code_t i_rc;
mmc_subchannel_t mmc_subchannel; cdio_mmc_subchannel_t mmc_subchannel;
if (!p_cdio) return DRIVER_OP_UNINIT; if (!p_cdio) return DRIVER_OP_UNINIT;
@@ -596,7 +607,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
memset(&cdb, 0, sizeof(mmc_cdb_t)); memset(&cdb, 0, sizeof(mmc_cdb_t));
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_SUBCHANNEL); CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_SUBCHANNEL);
CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(mmc_subchannel_t)); CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(cdio_mmc_subchannel_t));
cdb.field[1] = CDIO_CDROM_MSF; cdb.field[1] = CDIO_CDROM_MSF;
cdb.field[2] = 0x40; /* subq */ cdb.field[2] = 0x40; /* subq */
@@ -604,7 +615,7 @@ mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
cdb.field[6] = 0; /* track number (only in isrc mode, ignored) */ cdb.field[6] = 0; /* track number (only in isrc mode, ignored) */
i_rc = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ, i_rc = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ,
sizeof(mmc_subchannel_t), &mmc_subchannel); sizeof(cdio_mmc_subchannel_t), &mmc_subchannel);
if (DRIVER_OP_SUCCESS == i_rc) { if (DRIVER_OP_SUCCESS == i_rc) {
p_subchannel->format = mmc_subchannel.format; p_subchannel->format = mmc_subchannel.format;
p_subchannel->audio_status = mmc_subchannel.audio_status; p_subchannel->audio_status = mmc_subchannel.audio_status;
@@ -872,7 +883,7 @@ mmc_get_mcn ( const CdIo_t *p_cdio )
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,
const mmc_cdb_t *p_cdb, const mmc_cdb_t *p_cdb,
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 )
{ {
if (!p_cdio) return DRIVER_OP_UNINIT; if (!p_cdio) return DRIVER_OP_UNINIT;
@@ -1148,7 +1159,7 @@ const char *mmc_feature_profile2str( int i_feature_profile )
* @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, mmc_feature_interface_t e_interface ) mmc_have_interface( CdIo_t *p_cdio, cdio_mmc_feature_interface_t e_interface )
{ {
int i_status; /* Result of MMC command */ int i_status; /* Result of MMC command */
uint8_t buf[500] = { 0, }; /* Place to hold returned data */ uint8_t buf[500] = { 0, }; /* Place to hold returned data */

View File

@@ -1,6 +1,6 @@
/* private MMC helper routines. /* private MMC helper routines.
$Id: mmc_private.h,v 1.8 2005/03/06 00:03:53 rocky Exp $ $Id: mmc_private.h,v 1.9 2005/10/21 11:13:54 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -110,7 +110,7 @@ typedef driver_return_code_t (*mmc_run_cmd_fn_t)
unsigned int i_timeout_ms, unsigned int i_timeout_ms,
unsigned int i_cdb, unsigned int i_cdb,
const mmc_cdb_t *p_cdb, const mmc_cdb_t *p_cdb,
mmc_direction_t e_direction, cdio_mmc_direction_t e_direction,
unsigned int i_buf, /*in/out*/ void *p_buf ); unsigned int i_buf, /*in/out*/ void *p_buf );
int mmc_set_blocksize_mmc_private ( const void *p_env, const int mmc_set_blocksize_mmc_private ( const void *p_env, const