// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DiscInformation.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// 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 3 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, see .
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System;
namespace DiscImageChef.Decoders.SCSI.MMC
{
///
/// Information from the following standards:
/// ANSI X3.304-1997
/// T10/1048-D revision 9.0
/// T10/1048-D revision 10a
/// T10/1228-D revision 7.0c
/// T10/1228-D revision 11a
/// T10/1363-D revision 10g
/// T10/1545-D revision 1d
/// T10/1545-D revision 5
/// T10/1545-D revision 5a
/// T10/1675-D revision 2c
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
///
public static class DiscInformation
{
public struct StandardDiscInformation
{
///
/// Bytes 0 to 1
/// 32 + OPCTablesNumber*8
///
public UInt16 DataLength;
///
/// Byte 2, bits 7 to 5
/// 000b
///
public byte DataType;
///
/// Byte 2, bit 4
/// If set, disc is erasable
///
public bool Erasable;
///
/// Byte 2, bits 3 to 2
/// Status of last session
///
public byte LastSessionStatus;
///
/// Byte 2, bits 1 to 0
/// Status of disc
///
public byte DiscStatus;
///
/// Byte 3
/// Number of logical track that contains LBA 0
///
public byte FirstTrackNumber;
///
/// Byte 9 (MSB) and byte 4 (LSB)
/// Number of sessions
///
public byte Sessions;
///
/// Byte 10 (MSB) and byte 5 (LSB)
/// Number of first track in last session
///
public byte FirstTrackLastSession;
///
/// Byte 11 (MSB) and byte 6 (LSB)
/// Number of last track in last session
///
public byte LastTrackLastSession;
///
/// Byte 7, bit 7
/// If set, DiscIdentification is valid
///
public bool DID_V;
///
/// Byte 7, bit 6
/// If set, DiscBarcode is valid
///
public bool DBC_V;
///
/// Byte 7, bit 5
/// If set, disc is unrestricted
///
public bool URU;
///
/// Byte 7, bit 4
/// If set DiscApplicationCode is valid
///
public bool DAC_V;
///
/// Byte 7, bit 3
/// Reserved
///
public bool Reserved;
///
/// Byte 7, bit 2
/// Copy of dirty bit from MRW status
///
public bool Dbit;
///
/// Byte 7, bits 1 to 0
/// Background format status
///
public byte BGFormatStatus;
///
/// Byte 8
/// Disc type code
///
public byte DiscType;
///
/// Bytes 12 to 15
/// Disc identification number from PMA
///
public UInt32 DiscIdentification;
///
/// Bytes 16 to 19
/// Last Session Lead-in Start Address (MSF for CD, LBA for others)
///
public UInt32 LastSessionLeadInStartLBA;
///
/// Bytes 20 to 23
/// Last Possible Lead-out Start Address (MSF for CD, LBA for others)
///
public UInt32 LastPossibleLeadOutStartLBA;
///
/// Bytes 24 to 31
/// Disc barcode
///
public UInt64 DiscBarcode;
///
/// Byte 32
/// Disc application code
///
public byte DiscApplicationCode;
///
/// Byte 33
/// How many OPC tables are
///
public byte OPCTablesNumber;
///
/// Bytes 34 to end
/// OPC tables (8 bytes each)
///
public OPCTable[] OPCTables;
}
public struct OPCTable
{
///
/// Bytes 0 to 1
/// kilobytes/sec this OPC table applies to
///
public UInt16 Speed;
///
/// Bytes 2 to 7
/// OPC values
///
public byte[] OPCValues;
}
public struct TrackResourcesInformation
{
///
/// Bytes 0 to 1
/// 10
///
public UInt16 DataLength;
///
/// Byte 2, bits 7 to 5
/// 001b
///
public byte DataType;
///
/// Byte 2, bits 4 to 0
/// Reserved
///
public byte Reserved1;
///
/// Byte 3
/// Reserved
///
public byte Reserved2;
///
/// Bytes 4 to 5
/// Maximum possible number of the tracks on the disc
///
public UInt16 MaxTracks;
///
/// Bytes 6 to 7
/// Number of the assigned tracks on the disc
///
public UInt16 AssignedTracks;
///
/// Bytes 8 to 9
/// Maximum possible number of appendable tracks on the disc
///
public UInt16 MaxAppendableTracks;
///
/// Bytes 10 to 11
/// Current number of appendable tracks on the disc
///
public UInt16 AppendableTracks;
}
public struct POWResourcesInformation
{
///
/// Bytes 0 to 1
/// 14
///
public UInt16 DataLength;
///
/// Byte 2, bits 7 to 5
/// 010b
///
public byte DataType;
///
/// Byte 2, bits 4 to 0
/// Reserved
///
public byte Reserved1;
///
/// Byte 3
/// Reserved
///
public byte Reserved2;
///
/// Bytes 4 to 7
/// Remaining POW replacements
///
public UInt32 RemainingPOWReplacements;
///
/// Bytes 8 to 11
/// Remaining POW reallocation map entries
///
public UInt32 RemainingPOWReallocation;
///
/// Bytes 12 to 15
/// Number of remaining POW updates
///
public UInt32 RemainingPOWUpdates;
}
}
}