1 /* 2 Copyright (C) 2010, 2012 Rocky Bernstein <rocky@gnu.org> 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 /** 19 \file mmc_util.h 20 21 \brief Multimedia Command (MMC) "helper" routines that don't depend 22 on anything other than headers. 23 */ 24 25 #ifndef CDIO_MMC_UTIL_H_ 26 #define CDIO_MMC_UTIL_H_ 27 28 #include <cdio/device.h> 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif /* __cplusplus */ 33 34 /** 35 Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */ 36 typedef enum { 37 CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disc, capable 38 of changing behavior */ 39 CDIO_MMC_FEATURE_PROF_REMOVABLE = 0x0002, /**< disk Re-writable; with 40 removable media */ 41 CDIO_MMC_FEATURE_PROF_MO_ERASABLE = 0x0003, /**< Erasable Magneto-Optical 42 disk with sector erase 43 capability */ 44 CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE = 0x0004, /**< Write Once Magneto-Optical 45 write once */ 46 CDIO_MMC_FEATURE_PROF_AS_MO = 0x0005, /**< Advance Storage 47 Magneto-Optical */ 48 CDIO_MMC_FEATURE_PROF_CD_ROM = 0x0008, /**< Read only Compact Disc 49 capable */ 50 CDIO_MMC_FEATURE_PROF_CD_R = 0x0009, /**< Write once Compact Disc 51 capable */ 52 CDIO_MMC_FEATURE_PROF_CD_RW = 0x000A, /**< CD-RW Re-writable 53 Compact Disc capable */ 54 55 CDIO_MMC_FEATURE_PROF_DVD_ROM = 0x0010, /**< Read only DVD */ 56 CDIO_MMC_FEATURE_PROF_DVD_R_SEQ = 0x0011, /**< Re-recordable DVD using 57 Sequential recording */ 58 CDIO_MMC_FEATURE_PROF_DVD_RAM = 0x0012, /**< Re-writable DVD */ 59 CDIO_MMC_FEATURE_PROF_DVD_RW_RO = 0x0013, /**< Re-recordable DVD using 60 Restricted Overwrite */ 61 CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ = 0x0014, /**< Re-recordable DVD using 62 Sequential recording */ 63 CDIO_MMC_FEATURE_PROF_DVD_R_DL_SEQ = 0x0015, /**< DVD-R/DL sequential 64 recording */ 65 CDIO_MMC_FEATURE_PROF_DVD_R_DL_JR = 0x0016, /**< DVD-R/DL layer jump 66 recording */ 67 CDIO_MMC_FEATURE_PROF_DVD_PRW = 0x001A, /**< DVD+RW - DVD ReWritable */ 68 CDIO_MMC_FEATURE_PROF_DVD_PR = 0x001B, /**< DVD+R - DVD Recordable */ 69 CDIO_MMC_FEATURE_PROF_DDCD_ROM = 0x0020, /**< Read only DDCD */ 70 CDIO_MMC_FEATURE_PROF_DDCD_R = 0x0021, /**< DDCD-R Write only DDCD */ 71 CDIO_MMC_FEATURE_PROF_DDCD_RW = 0x0022, /**< Re-Write only DDCD */ 72 CDIO_MMC_FEATURE_PROF_DVD_PRW_DL = 0x002A, /**< "DVD+RW/DL */ 73 CDIO_MMC_FEATURE_PROF_DVD_PR_DL = 0x002B, /**< DVD+R - DVD Recordable 74 double layer */ 75 76 CDIO_MMC_FEATURE_PROF_BD_ROM = 0x0040, /**< BD-ROM */ 77 CDIO_MMC_FEATURE_PROF_BD_SEQ = 0x0041, /**< BD-R sequential 78 recording */ 79 CDIO_MMC_FEATURE_PROF_BD_R_RANDOM = 0x0042, /**< BD-R random recording */ 80 CDIO_MMC_FEATURE_PROF_BD_RE = 0x0043, /**< BD-RE */ 81 82 CDIO_MMC_FEATURE_PROF_HD_DVD_ROM = 0x0050, /**< HD-DVD-ROM */ 83 CDIO_MMC_FEATURE_PROF_HD_DVD_R = 0x0051, /**< HD-DVD-R */ 84 CDIO_MMC_FEATURE_PROF_HD_DVD_RAM = 0x0052, /**<"HD-DVD-RAM */ 85 86 CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not 87 conform to any Profile. */ 88 } cdio_mmc_feature_profile_t; 89 90 /** 91 @param i_feature MMC feature number 92 @return string containing the name of the given feature 93 */ 94 const char *mmc_feature2str( int i_feature ); 95 96 /** 97 Get drive capabilities for a device. 98 @param p_cdio the CD object to be acted upon. 99 @param p_read_cap list of read capabilities that are set on return 100 @param p_write_cap list of write capabilities that are set on return 101 @param p_misc_cap list of miscellaneous capabilities (that are neither 102 read nor write related) that are set on return 103 */ 104 void mmc_get_drive_cap ( CdIo_t *p_cdio, 105 /*out*/ cdio_drive_read_cap_t *p_read_cap, 106 /*out*/ cdio_drive_write_cap_t *p_write_cap, 107 /*out*/ cdio_drive_misc_cap_t *p_misc_cap); 108 109 /** 110 Return a string containing the name of the given feature 111 */ 112 const char *mmc_feature_profile2str( int i_feature_profile ); 113 114 bool mmc_is_disctype_bd(cdio_mmc_feature_profile_t disctype); 115 bool mmc_is_disctype_cdrom(cdio_mmc_feature_profile_t disctype); 116 bool mmc_is_disctype_dvd(cdio_mmc_feature_profile_t disctype); 117 bool mmc_is_disctype_hd_dvd (cdio_mmc_feature_profile_t disctype); 118 bool mmc_is_disctype_overwritable (cdio_mmc_feature_profile_t disctype); 119 bool mmc_is_disctype_rewritable(cdio_mmc_feature_profile_t disctype); 120 121 /** The default read timeout is 3 minutes. */ 122 #define MMC_READ_TIMEOUT_DEFAULT 3*60*1000 123 124 /** 125 Set this to the maximum value in milliseconds that we will 126 wait on an MMC read command. 127 */ 128 extern uint32_t mmc_read_timeout_ms; 129 130 /** 131 Maps a mmc_sense_key_t into a string name. 132 */ 133 extern const char mmc_sense_key2str[16][40]; 134 135 /** 136 The default timeout (non-read) is 6 seconds. 137 */ 138 #define MMC_TIMEOUT_DEFAULT 6000 139 140 /** 141 Set this to the maximum value in milliseconds that we will 142 wait on an MMC command. 143 */ 144 extern uint32_t mmc_timeout_ms; 145 146 #ifdef __cplusplus 147 } 148 #endif /* __cplusplus */ 149 150 #endif /* CDIO_MMC_UTIL_H_ */ 151 /* 152 * Local variables: 153 * c-file-style: "gnu" 154 * tab-width: 8 155 * indent-tabs-mode: nil 156 * End: 157 */ 158