2004-07-26 02:54:37 +00:00
|
|
|
/* private MMC helper routines.
|
|
|
|
|
|
2005-03-01 09:33:52 +00:00
|
|
|
$Id: mmc_private.h,v 1.7 2005/03/01 09:33:52 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.
|
|
|
|
|
************************************************************/
|
2005-03-01 09:33:52 +00:00
|
|
|
/*!
|
|
|
|
|
Read Audio Subchannel information
|
|
|
|
|
|
|
|
|
|
@param p_user_data the CD object to be acted upon.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
driver_return_code_t
|
|
|
|
|
audio_read_subchannel_mmc ( void *p_user_data,
|
|
|
|
|
cdio_subchannel_t *p_subchannel);
|
|
|
|
|
|
2005-01-24 00:06:31 +00:00
|
|
|
/*!
|
|
|
|
|
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);
|
|
|
|
|
|
2005-02-17 04:57:21 +00:00
|
|
|
/*! Read just the user data part of some sort of data sector (via
|
|
|
|
|
mmc_read_cd).
|
|
|
|
|
|
|
|
|
|
@param p_user_data object to read from
|
|
|
|
|
|
|
|
|
|
@param p_buf place to read data into. The caller should make sure
|
|
|
|
|
this location can store at least CDIO_CD_FRAMESIZE,
|
|
|
|
|
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on
|
|
|
|
|
the kind of sector getting read. If you don't know
|
|
|
|
|
whether you have a Mode 1/2, Form 1/ Form 2/Formless
|
|
|
|
|
sector best to reserve space for the maximum,
|
|
|
|
|
M2RAW_SECTOR_SIZE.
|
|
|
|
|
|
|
|
|
|
@param i_lsn sector to read
|
|
|
|
|
@param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,
|
|
|
|
|
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf.
|
|
|
|
|
|
|
|
|
|
*/
|
2005-02-17 07:03:36 +00:00
|
|
|
driver_return_code_t read_data_sectors_mmc ( void *p_user_data,
|
|
|
|
|
void *p_buf, lsn_t i_lsn,
|
|
|
|
|
uint16_t i_blocksize,
|
|
|
|
|
uint32_t i_blocks );
|
2005-02-17 04:57:21 +00:00
|
|
|
char *get_mcn_mmc (const void *p_user_data);
|
|
|
|
|
|
2005-01-24 00:06:31 +00:00
|
|
|
/* Set read blocksize (via MMC) */
|
2005-02-17 04:57:21 +00:00
|
|
|
driver_return_code_t set_blocksize_mmc (void *p_user_data,
|
|
|
|
|
uint16_t i_blocksize);
|
2005-01-24 00:06:31 +00:00
|
|
|
|
|
|
|
|
/* 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-17 04:57:21 +00:00
|
|
|
uint16_t i_blocksize );
|
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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
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-17 04:57:21 +00:00
|
|
|
uint16_t i_blocksize);
|