2004-07-26 02:54:37 +00:00
|
|
|
/* private MMC helper routines.
|
|
|
|
|
|
2005-02-07 03:36:01 +00:00
|
|
|
$Id: mmc_private.h,v 1.3 2005/02/07 03:36:02 rocky Exp $
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2005-01-23 19:16:58 +00:00
|
|
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
2004-07-26 02:54:37 +00:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
2005-02-07 03:36:01 +00:00
|
|
|
#include <cdio/mmc.h>
|
2004-07-27 01:06:01 +00:00
|
|
|
#include "cdtext_private.h"
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2004-07-28 01:09:59 +00:00
|
|
|
/*! Convert milliseconds to seconds taking the ceiling value, i.e.
|
|
|
|
|
1002 milliseconds gets rounded to 2 seconds.
|
|
|
|
|
*/
|
|
|
|
|
#define SECS2MSECS 1000
|
|
|
|
|
static inline unsigned int
|
2004-07-28 01:14:42 +00:00
|
|
|
msecs2secs(unsigned int msecs)
|
2004-07-28 01:09:59 +00:00
|
|
|
{
|
|
|
|
|
return (msecs+(SECS2MSECS-1)) / SECS2MSECS;
|
|
|
|
|
}
|
|
|
|
|
#undef SECS2MSECS
|
|
|
|
|
|
2005-01-24 00:06:31 +00:00
|
|
|
/***********************************************************
|
|
|
|
|
MMC CdIo Operations which a driver may use.
|
|
|
|
|
These are not directly user-accessible.
|
|
|
|
|
************************************************************/
|
|
|
|
|
/*!
|
|
|
|
|
Get the block size for subsequest read requests, via a SCSI MMC
|
|
|
|
|
MODE_SENSE 6 command.
|
|
|
|
|
*/
|
|
|
|
|
int get_blocksize_mmc (void *p_user_data);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Get the lsn of the end of the CD
|
|
|
|
|
|
|
|
|
|
@return the lsn. On error return CDIO_INVALID_LSN.
|
|
|
|
|
*/
|
|
|
|
|
lsn_t get_disc_last_lsn_mmc( void *p_user_data );
|
|
|
|
|
|
|
|
|
|
void get_drive_cap_mmc (const void *p_user_data,
|
|
|
|
|
/*out*/ cdio_drive_read_cap_t *p_read_cap,
|
|
|
|
|
/*out*/ cdio_drive_write_cap_t *p_write_cap,
|
|
|
|
|
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
|
|
|
|
|
|
2005-02-06 11:13:37 +00:00
|
|
|
int get_media_changed_mmc (const void *p_user_data);
|
|
|
|
|
|
2005-01-24 00:06:31 +00:00
|
|
|
char *get_mcn_mmc (const void *p_user_data);
|
|
|
|
|
|
|
|
|
|
/* Set read blocksize (via MMC) */
|
|
|
|
|
driver_return_code_t set_blocksize_mmc (void *p_user_data, int i_blocksize);
|
|
|
|
|
|
|
|
|
|
/* Set CD-ROM drive speed (via MMC) */
|
|
|
|
|
driver_return_code_t set_speed_mmc (void *p_user_data, int i_speed);
|
|
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
|
Miscellaenous other "private" routines. Probably need
|
|
|
|
|
to better classify these.
|
|
|
|
|
************************************************************/
|
|
|
|
|
|
2005-02-06 11:13:37 +00:00
|
|
|
typedef driver_return_code_t (*mmc_run_cmd_fn_t)
|
2005-01-24 00:06:31 +00:00
|
|
|
( void *p_user_data,
|
|
|
|
|
unsigned int i_timeout_ms,
|
|
|
|
|
unsigned int i_cdb,
|
|
|
|
|
const scsi_mmc_cdb_t *p_cdb,
|
|
|
|
|
scsi_mmc_direction_t e_direction,
|
|
|
|
|
unsigned int i_buf, /*in/out*/ void *p_buf );
|
2004-07-26 02:54:37 +00:00
|
|
|
|
2005-02-05 13:07:02 +00:00
|
|
|
int mmc_set_blocksize_mmc_private ( const void *p_env, const
|
2005-02-06 11:13:37 +00:00
|
|
|
mmc_run_cmd_fn_t run_mmc_cmd,
|
2005-02-05 13:07:02 +00:00
|
|
|
unsigned int bsize );
|
2004-07-26 03:58:25 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Get the DVD type associated with cd object.
|
|
|
|
|
*/
|
|
|
|
|
discmode_t
|
2005-02-05 13:07:02 +00:00
|
|
|
mmc_get_dvd_struct_physical_private ( void *p_env,
|
2005-02-06 11:13:37 +00:00
|
|
|
mmc_run_cmd_fn_t run_mmc_cmd,
|
2005-02-05 13:07:02 +00:00
|
|
|
cdio_dvd_struct_t *s );
|
2004-07-27 01:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2005-02-05 13:07:02 +00:00
|
|
|
mmc_get_blocksize_private ( void *p_env,
|
2005-02-06 11:13:37 +00:00
|
|
|
mmc_run_cmd_fn_t run_mmc_cmd);
|
2004-07-27 01:06:01 +00:00
|
|
|
|
2005-02-05 13:07:02 +00:00
|
|
|
char *mmc_get_mcn_private ( void *p_env,
|
2005-02-06 11:13:37 +00:00
|
|
|
mmc_run_cmd_fn_t run_mmc_cmd
|
2005-02-05 13:07:02 +00:00
|
|
|
);
|
2004-07-27 02:45:16 +00:00
|
|
|
|
2005-02-05 13:07:02 +00:00
|
|
|
bool mmc_init_cdtext_private ( void *p_user_data,
|
2005-02-06 11:13:37 +00:00
|
|
|
mmc_run_cmd_fn_t run_mmc_cmd,
|
2005-02-05 13:07:02 +00:00
|
|
|
set_cdtext_field_fn_t set_cdtext_field_fn
|
|
|
|
|
);
|
2004-07-27 02:45:16 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
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
|
|
|
|
|
capabilities.
|
|
|
|
|
*/
|
2005-02-05 13:07:02 +00:00
|
|
|
void mmc_get_drive_cap_buf(const uint8_t *p,
|
|
|
|
|
/*out*/ cdio_drive_read_cap_t *p_read_cap,
|
|
|
|
|
/*out*/ cdio_drive_write_cap_t *p_write_cap,
|
|
|
|
|
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
|
2004-07-27 02:45:16 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Return the the kind of drive capabilities of device.
|
|
|
|
|
|
|
|
|
|
Note: string is malloc'd so caller should free() then returned
|
|
|
|
|
string when done with it.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
void
|
2005-02-05 13:07:02 +00:00
|
|
|
mmc_get_drive_cap_private ( void *p_env,
|
2005-02-06 11:13:37 +00:00
|
|
|
const mmc_run_cmd_fn_t run_mmc_cmd,
|
2005-02-05 13:07:02 +00:00
|
|
|
/*out*/ cdio_drive_read_cap_t *p_read_cap,
|
|
|
|
|
/*out*/ cdio_drive_write_cap_t *p_write_cap,
|
|
|
|
|
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
|
2005-01-23 19:16:58 +00:00
|
|
|
driver_return_code_t
|
2005-02-05 13:07:02 +00:00
|
|
|
mmc_set_blocksize_private ( void *p_env,
|
2005-02-06 11:13:37 +00:00
|
|
|
const mmc_run_cmd_fn_t run_mmc_cmd,
|
2005-02-05 13:07:02 +00:00
|
|
|
unsigned int i_bsize);
|