Add READTOC format defines.

This commit is contained in:
rocky
2004-07-19 01:13:31 +00:00
parent f33f04ac99
commit 8a99889f49
8 changed files with 87 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: scsi_mmc.h,v 1.8 2004/07/17 22:16:47 rocky Exp $
$Id: scsi_mmc.h,v 1.9 2004/07/19 01:13:31 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,18 +26,27 @@
#ifndef __SCSI_MMC_H__
#define __SCSI_MMC_H__
/* Leval values that can go into READ_CD */
#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_MODE1 2 /* Only mode1 sectors (user data = 2048) */
#define CDIO_MMC_READ_TYPE_MODE2 3 /* mode2 sectors form1 or form2 */
#define CDIO_MMC_READ_TYPE_M2F1 4 /* mode2 sectors form1 */
#define CDIO_MMC_READ_TYPE_M2F2 5 /* mode2 sectors form2 */
/*! Level values that can go into READ_CD */
#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_MODE1 2 /**< mode1 sectors (user data = 2048) */
#define CDIO_MMC_READ_TYPE_MODE2 3 /**< mode2 sectors form1 or form2 */
#define CDIO_MMC_READ_TYPE_M2F1 4 /**< mode2 sectors form1 */
#define CDIO_MMC_READ_TYPE_M2F2 5 /**< mode2 sectors form2 */
/*! Format values for READ_TOC */
#define CDIO_MMC_READTOC_FMT_TOC 0
#define CDIO_MMC_READTOC_FMT_SESSION 1
#define CDIO_MMC_READTOC_FMT_FULTOC 2
#define CDIO_MMC_READTOC_FMT_PMA 3 /**< Q subcode data */
#define CDIO_MMC_READTOC_FMT_ATIP 4 /**< includes media type */
#define CDIO_MMC_READTOC_FMT_CDTEXT 5 /**< CD-TEXT info */
/*! The generic packet command opcodes for CD/DVD Logical Units. */
#define CDIO_MMC_GPCMD_MODE_SENSE 0x1a
#define CDIO_MMC_GPCMD_START_STOP 0x1b
#define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL 0x1e
#define CDIO_MMC_GPCMD_READ_10 0x28
#define CDIO_MMC_GPCMD_READ_SUBCHANNEL 0x42
#define CDIO_MMC_GPCMD_READ_TOC 0x43
@@ -47,7 +56,6 @@
#define CDIO_MMC_GPCMD_READ_12 0xa8
#define CDIO_MMC_GPCMD_READ_CD 0xbe
#define CDIO_MMC_GPCMD_READ_MSF 0xb9
#define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL 0x1e
/*! Page codes for MODE SENSE and MODE SET. */
@@ -96,13 +104,13 @@
rec[9] = val;
/*!
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
capabilities.
*/
void cdio_get_drive_cap_mmc(const uint8_t *p,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap);
/*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);
#endif /* __SCSI_MMC_H__ */

View File

@@ -1,5 +1,5 @@
/*
$Id: types.h,v 1.20 2004/07/18 03:35:07 rocky Exp $
$Id: types.h,v 1.21 2004/07/19 01:13:31 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -306,7 +306,7 @@ extern "C" {
/*! Reading masks.. */
#define CDIO_DRIVE_CAP_READ_AUDIO 0x00001 /**< drive can play CD audio */
#define CDIO_DRIVE_CAP_READ_CD_DA 0x00002 /**< drive can read CD-DA */
#define CDIO_DRIVE_CAP_READ_CD_G 0x00004 /**< drive can read CD G */
#define CDIO_DRIVE_CAP_READ_CD_G 0x00004 /**< drive can read CD+G */
#define CDIO_DRIVE_CAP_READ_CD_R 0x00008 /**< drive can read CD-R */
#define CDIO_DRIVE_CAP_READ_CD_RW 0x00010 /**< drive can read CD-RW */
#define CDIO_DRIVE_CAP_READ_DVD_R 0x00020 /**< drive can read DVD-R */
@@ -325,8 +325,8 @@ extern "C" {
#define CDIO_DRIVE_CAP_WRITE_DVD_RAM 0x00010 /**< drive can write DVD-RAM */
#define CDIO_DRIVE_CAP_WRITE_DVD_RW 0x00020 /**< drive can write DVD-RAM */
#define CDIO_DRIVE_CAP_WRITE_DVD_RPW 0x00040 /**< drive can write DVD-RAM */
#define CDIO_DRIVE_CAP_WRITE_MT_RAIN 0x00080 /**< Mount Rainier */
#define CDIO_DRIVE_CAP_WRITE_BUF_UN 0x00100 /**< buffer underrun protect'n */
#define CDIO_DRIVE_CAP_WRITE_MT_RAINIER 0x00080 /**< Mount Rainier */
#define CDIO_DRIVE_CAP_WRITE_BURN_PROOF 0x00100 /**< burn proof */
/**< Masks derived from above... */
#define CDIO_DRIVE_CAP_WRITE_CD ( \

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd_cam.c,v 1.18 2004/07/18 04:19:48 rocky Exp $
$Id: freebsd_cam.c,v 1.19 2004/07/19 01:13:32 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.18 2004/07/18 04:19:48 rocky Exp $";
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.19 2004/07/19 01:13:32 rocky Exp $";
#ifdef HAVE_FREEBSD_CDROM
@@ -353,11 +353,18 @@ stat_size_freebsd_cam (_img_private_t *env)
sizeof(env->ccb.csio.sense_data), 0, 30*1000);
env->ccb.csio.cdb_len = 8+1;
/* Operation code */
CDIO_MMC_SET_COMMAND(env->ccb.csio.cdb_io.cdb_bytes,
CDIO_MMC_GPCMD_READ_TOC);
env->ccb.csio.cdb_io.cdb_bytes[1] = 0; /* lba; msf: 0x2 */
/* Format */
env->ccb.csio.cdb_io.cdb_bytes[2] = CDIO_MMC_READTOC_FMT_TOC;
CDIO_MMC_SET_START_TRACK(env->ccb.csio.cdb_io.cdb_bytes,
CDIO_CDROM_LEADOUT_TRACK);
env->ccb.csio.cdb_io.cdb_bytes[8] = 12; /* ? */
env->ccb.csio.data_ptr = buf;

View File

@@ -1,5 +1,5 @@
/*
$Id: aspi32.c,v 1.29 2004/07/18 06:51:49 rocky Exp $
$Id: aspi32.c,v 1.30 2004/07/19 01:13:32 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: aspi32.c,v 1.29 2004/07/18 06:51:49 rocky Exp $";
static const char _rcsid[] = "$Id: aspi32.c,v 1.30 2004/07/19 01:13:32 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -569,13 +569,16 @@ read_toc_aspi (_img_private_t *env)
ssc.SRB_SenseLen = SENSE_LEN;
ssc.SRB_PostProc = (LPVOID) hEvent;
/* Sizes for command descriptor buffer (CDB) are set by the SCSI opcode.
The size for READ TOC is 10. */
ssc.SRB_CDBLen = 10;
/* Operation code */
CDIO_MMC_SET_COMMAND(ssc.CDBByte, CDIO_MMC_GPCMD_READ_TOC);
/* Format */
ssc.CDBByte[ 2 ] = READ_TOC_FORMAT_TOC;
ssc.CDBByte[ 2 ] = CDIO_MMC_READTOC_FMT_TOC;
/* Starting track */
CDIO_MMC_SET_START_TRACK(ssc.CDBByte, 0);

View File

@@ -1,5 +1,5 @@
/*
$Id: win32_ioctl.c,v 1.18 2004/07/18 06:51:49 rocky Exp $
$Id: win32_ioctl.c,v 1.19 2004/07/19 01:13:32 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.18 2004/07/18 06:51:49 rocky Exp $";
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.19 2004/07/19 01:13:32 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -425,9 +425,14 @@ init_cdtext_win32ioctl (_img_private_t *env)
sptd.DataBuffer= (void *) wdata;
sptd.SenseInfoOffset=0;
/* Operation code */
CDIO_MMC_SET_COMMAND(sptd.Cdb, CDIO_MMC_GPCMD_READ_TOC);
sptd.Cdb[1] = 0x02; /* MSF mode */
sptd.Cdb[2] = 0x05; /* CD text */
/* Format */
sptd.Cdb[2] = CDIO_MMC_READTOC_FMT_CDTEXT;
CDIO_MMC_SET_READ_LENGTH(sptd.Cdb, sizeof(wdata));
/* Send the command to drive */

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_linux.c,v 1.69 2004/07/18 03:35:07 rocky Exp $
$Id: _cdio_linux.c,v 1.70 2004/07/19 01:13:31 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.69 2004/07/18 03:35:07 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.70 2004/07/19 01:13:31 rocky Exp $";
#include <string.h>
@@ -718,9 +718,15 @@ _init_cdtext_linux (_img_private_t *env)
} scsi_cmd;
memset( scsi_cmd.cdb, 0, sizeof(scsi_cmd.cdb) );
/* Operation code */
CDIO_MMC_SET_COMMAND(scsi_cmd.cdb, CDIO_MMC_GPCMD_READ_TOC);
scsi_cmd.cdb[1] = 0x02; /* MSF mode */
scsi_cmd.cdb[2] = 0x05; /* CD text */
/* Format */
scsi_cmd.cdb[2] = CDIO_MMC_READTOC_FMT_CDTEXT;
CDIO_MMC_SET_READ_LENGTH(scsi_cmd.cdb, sizeof(scsi_cmd.wdata));
scsi_cmd.inlen = sizeof(scsi_cmd.cdb);

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_sunos.c,v 1.54 2004/07/18 03:35:07 rocky Exp $
$Id: _cdio_sunos.c,v 1.55 2004/07/19 01:13:32 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.54 2004/07/18 03:35:07 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.55 2004/07/19 01:13:32 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -442,9 +442,10 @@ _init_cdtext_solaris (_img_private_t *env)
The size for READ TOC is 10. */
unsigned char scsi_cdb[10] = {0, };
/* Operation code */
CDIO_MMC_SET_COMMAND(scsi_cdb, CDIO_MMC_GPCMD_READ_TOC);
scsi_cdb[1] = 0x02; /* MSF mode */
scsi_cdb[2] = 0x05; /* CD text */
scsi_cdb[2] = CDIO_MMC_READTOC_FMT_CDTEXT;
CDIO_MMC_SET_READ_LENGTH( scsi_cdb, sizeof(wdata) );
my_cmd.uscsi_flags = (USCSI_READ|USCSI_RQENABLE); /* We're going get data */
@@ -625,7 +626,7 @@ _get_drive_cap_solaris (const void *user_data,
my_cmd.uscsi_rqbuf = my_rq_buf; /* Pointer to the request sense buffer */
status = ioctl(env->gen.fd, USCSICMD, &my_cmd);
if(status == 0) {
if (status == 0) {
uint8_t *p;
int lenData = ((unsigned int)buf[0] << 8) + buf[1];
uint8_t *pMax = buf + 256;

View File

@@ -1,6 +1,6 @@
/* Common MMC routines.
$Id: scsi_mmc.c,v 1.5 2004/07/18 03:35:07 rocky Exp $
$Id: scsi_mmc.c,v 1.6 2004/07/19 01:13:32 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,15 +27,15 @@
#include <cdio/scsi_mmc.h>
/*!
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
capabilities.
*/
void
cdio_get_drive_cap_mmc(const uint8_t *p,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap)
/*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)
{
/* Reader */
if (p[2] & 0x01) *p_read_cap |= CDIO_DRIVE_CAP_READ_CD_R;
@@ -50,10 +50,10 @@ cdio_get_drive_cap_mmc(const uint8_t *p,
if (p[3] & 0x02) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_CD_RW;
if (p[3] & 0x10) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_DVD_R;
if (p[3] & 0x20) *p_write_cap |= CDIO_DRIVE_CAP_WRITE_DVD_RAM;
if (p[4] & 0x80) *p_misc_cap |= CDIO_DRIVE_CAP_WRITE_BURN_PROOF;
/* Misc */
if (p[4] & 0x40) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_MULTI_SESSION;
if (p[6] & 0x01) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_LOCK;
if (p[6] & 0x08) *p_misc_cap |= CDIO_DRIVE_CAP_MISC_EJECT;
if (p[6] >> 5 != 0)