From f006ee5436c15b426f84b4338b7729ffeb961b54 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 26 Apr 2008 15:07:39 +0000 Subject: [PATCH] Enabled quick formatting with DVD-RAM, made slow formatting default with BD-RE --- cdrskin/cdrskin_timestamp.h | 2 +- doc/cookbook.txt | 14 +++++++- libburn/drive.c | 2 +- libburn/libburn.h | 3 +- libburn/mmc.c | 70 ++++++++++++++++++++++++++----------- 5 files changed, 67 insertions(+), 24 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index a6fd694..696720b 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2008.04.25.132353" +#define Cdrskin_timestamP "2008.04.26.150646" diff --git a/doc/cookbook.txt b/doc/cookbook.txt index 0810e5a..a2a6649 100644 --- a/doc/cookbook.txt +++ b/doc/cookbook.txt @@ -695,7 +695,7 @@ managment. There is no way to increase payload capacity by format 01h. With BD-RE there are three format types : 00h, 30h and 31h. 00h offers the default size format. 30h offers several sizes with defect management. Usually there are three -size th choose: #1: default size, #2: maximum spare area, #3: minimal spare. +size to choose: #1: default size, #2: maximum spare area, #3: minimal spare. 31h offers a single size and disables defect management. This has the side effect to speed up writing to nominal speed. (mmc5r03c.pdf 6.5.4.2.15, 6.24.3.3, Table 472) @@ -716,6 +716,18 @@ Usable with 30h seem 10b Full Certification and 11b Quick Certification. Usable with 31h seem also 00b Quick Reformat and 01b No Certification. (mmc5r03c.pdf 6.5.4.2.15.1) +Other format types have their certification intensity controlled by +a pair of bits: CmpList and DCRT. +CmpList resides in CDB byte 1 as bit 3. DCRT resides in the payload byte 1 +as bit 5. Both together should request a quick size change without lengthy +certification but maintaining the list of known defects. +(mmc5r03c.pdf 6.5, table 249, 6.5.3.2) +With DVD-RAM on my PHILIPS SPD3300L drive they prevent any format size +change though. The TSSTcorp SH-S203B works properly. +With BD-RE format 00h, the default is specified to be Quick Reformat, +and with 00h in general certification can only be disabled not enabled. +(mmc5r03c.pdf 6.5.4.2.1.7) + ------------------------------------------------------------------------------- DVD-RAM and BD-RE tuning : diff --git a/libburn/drive.c b/libburn/drive.c index ae8eec1..c48ed0b 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -615,7 +615,7 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag) d->cancel = 0; d->busy = BURN_DRIVE_FORMATTING; - ret = d->format_unit(d, size, flag & 0xffb6); /* forward bits */ + ret = d->format_unit(d, size, flag & 0xfff6); /* forward bits */ if (ret <= 0) d->cancel = 1; diff --git a/libburn/libburn.h b/libburn/libburn.h index abb66fa..1341d7e 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -1185,7 +1185,7 @@ void burn_disc_erase(struct burn_drive *drive, int fast); bit1+2: size mode 0 = use parameter size as far as it makes sense 1 = insist in size 0 even if there is a better default known - (has no effect on DVD-RAM or BD-RE) + (on DVD-RAM or BD-RE identical to size mode 0) 2 = without bit7: format to maximum available size with bit7 : take size from indexed format descriptor 3 = without bit7: format to default size @@ -1193,6 +1193,7 @@ void burn_disc_erase(struct burn_drive *drive, int fast); bit3= -reserved- bit4= enforce re-format of (partly) formatted media bit5= try to disable eventual defect management + bit6= try to avoid lengthy media certification bit7= MMC expert application mode (else libburn tries to choose a suitable format type): bit8 to bit15 contain the index of the format to use. See diff --git a/libburn/mmc.c b/libburn/mmc.c index ebead7e..492e552 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -57,6 +57,7 @@ extern struct libdax_msgs *libdax_messenger; /* ts A80410 : <<< Dangerous experiment: Pretend that DVD-RAM is BD-RE # define Libburn_dvd_ram_as_bd_rE yes */ + /* ts A80425 : Prevents command FORMAT UNIT for DVD-RAM or BD-RE. Useful only to test the selection of format descriptors without actually formatting the media. @@ -2374,8 +2375,8 @@ static int mmc_read_format_capacities_al(struct burn_drive *d, #ifdef Libburn_dvd_ram_as_bd_rE - /* <<< dummy format descriptor list as obtained from dvd+rw-mediainfo - by Giulio Orsero in April 2008 + /* <<< dummy format descriptor list as obtained from + dvd+rw-mediainfo by Giulio Orsero in April 2008 */ d->num_format_descr = 5; d->format_descriptors[0].type = 0x00; @@ -2399,7 +2400,11 @@ static int mmc_read_format_capacities_al(struct burn_drive *d, /* silencing compiler warnings about unused variables */ num_blocks = size = sign = i = max_score = num_descr = score = type = 0; -#else /* Libburn_dvd_ram_as_bd_rE */ + if (d->current_profile == 0x12 || d->current_profile == 0x43) + return 1; + d->num_format_descr = 0; + +#endif /* Libburn_dvd_ram_as_bd_rE */ if (top_wanted == 0x00 || top_wanted == 0x10) sign = -1; /* the caller clearly desires full format */ @@ -2459,9 +2464,6 @@ static int mmc_read_format_capacities_al(struct burn_drive *d, } } -#endif /* ! Libburn_dvd_ram_as_bd_rE */ - - /* <<< sprintf(msg, "best_format_type = %2.2Xh , best_format_size = %.f", @@ -2613,6 +2615,7 @@ int mmc_read_buffer_capacity(struct burn_drive *d) bit3= expand format up to at least size bit4= enforce re-format of (partly) formatted media bit5= try to disable eventual defect management + bit6= try to avoid lengthy media certification bit7= bit8 to bit15 contain the index of the format to use bit8-bit15 = see bit7 */ @@ -2622,6 +2625,7 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag) struct command c; int ret, tolerate_failure = 0, return_immediately = 0, i, format_type; int index, format_sub_type = 0, format_00_index, size_mode; + int accept_count = 0; off_t num_of_blocks = 0, diff, format_size, i_size, format_00_max_size; char msg[160],descr[80]; int full_format_type = 0x00; /* Full Format (or 0x10 for DVD-RW ?) */ @@ -2688,8 +2692,19 @@ selected_not_suitable:; c.page->data[9 + i] = ( d->format_descriptors[index].tdp >> (16 - 8 * i)) & 0xff; - if (format_type == 0x30) - format_sub_type = 3; /* Quick certification */ + if (format_type == 0x30 || format_type == 0x31) { + if (flag & 64) + format_sub_type = 3; /* Quick certification */ + else + format_sub_type = 2; /* Full certification */ + } + if (d->current_profile == 0x12 && format_type !=0x01 && + (flag & 64)) { + /* DCRT and CmpList, see below */ + c.page->data[1] |= 0x20; + c.opcode[1] |= 0x08; + } + c.page->data[1] |= 0x80; /* FOV = this flag vector is valid */ sprintf(descr, "%s (descr %d)", d->current_profile_text,index); return_immediately = 1; /* caller must do the waiting */ @@ -2878,14 +2893,20 @@ no_suitable_formatting_type:; return_immediately = 1; /* caller must do the waiting */ c.page->data[1] |= 0x80; /* FOV = this flag vector is valid */ - /* <<< ts A80418 : experiment: MMC-5 6.5.3.2 , 6.5.4.2.1.2 - DCRT: Disable Certification and maintain number of blocks - c.page->data[1] |= 0x20; - */ - /* <<< ts A80418 : experiment: MMC-5 6.5.4.2.1.2 - Override maintaining of number of blocks with DCRT - c.opcode[1] |= 0x08; - */ + if ((flag & 64) && format_type != 0x01) { + /* MMC-5 6.5.3.2 , 6.5.4.2.1.2 + DCRT: Disable Certification and maintain number + of blocks + CmpList: Override maintaining of number of blocks + with DCRT + */ + /* ts A80426 : prevents change of formatted size + with PHILIPS SPD3300L and Verbatim 3x DVD-RAM + and format_type 0x00. Works on TSSTcorp SH-S203B + */ + c.page->data[1] |= 0x20; + c.opcode[1] |= 0x08; + } } else if (d->current_profile == 0x43 && burn_support_untested_profiles) { @@ -2906,14 +2927,18 @@ no_suitable_formatting_type:; /* search largest format 0x31 */ if(format_type != 0x31) continue; - format_sub_type = 3; /* Quick certification */ } else if(size_mode == 2) { /* max payload size */ /* search largest 0x30 format descriptor */ if(format_type != 0x30) continue; - format_sub_type = 3; /* Quick certification */ } else if(size_mode == 3) { /* default payload size */ - index = 0; + if (accept_count < 1) + index = 0; /* this cannot certify */ + if(format_type != 0x30) + continue; + accept_count++; + if (accept_count == 1) + index = i; continue; } else { /* defect managed format with size wish */ /* search for smallest 0x30 >= size */ @@ -2925,7 +2950,6 @@ no_suitable_formatting_type:; continue; index = i; format_size = i_size; - format_sub_type = 3; /* Quick certification */ continue; } /* common for all cases which search largest @@ -2940,6 +2964,12 @@ no_suitable_formatting_type:; if (index < 0) goto no_suitable_formatting_type; format_type = d->format_descriptors[index].type; + if (format_type == 0x30 || format_type == 0x31) { + if (flag & 64) + format_sub_type = 3; /* Quick certification */ + else + format_sub_type = 2; /* Full certification */ + } num_of_blocks = d->format_descriptors[index].size / 2048; mmc_int_to_four_char(c.page->data + 4, num_of_blocks); for (i = 0; i < 3; i++)