Began to implement formatting of DVD-RAM and experimentally of BD-RE

This commit is contained in:
Thomas Schmitt 2008-04-18 09:27:16 +00:00
parent 825a087513
commit dbec2d53a3
5 changed files with 78 additions and 21 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2008.04.16.082208" #define Cdrskin_timestamP "2008.04.18.092715"

View File

@ -392,6 +392,10 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
size = 0; size = 0;
flag &= ~(2|8); /* no insisting in size 0, no expansion */ flag &= ~(2|8); /* no insisting in size 0, no expansion */
flag |= 4; /* format up to maximum size */ flag |= 4; /* format up to maximum size */
} else if (drive->current_profile == 0x12) {
ok = 1; /* DVD-RAM */
} else if (drive->current_profile == 0x43) {
ok = 1; /* BD-RE */
} }
if (!ok) { if (!ok) {

View File

@ -592,7 +592,7 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
/* /*
@param flag: bit0 = fill formatted size with zeros @param flag: bit0 = fill formatted size with zeros
bit1, bit2 , bit4, bit7 - bit15 are for d->format_unit() bit1, bit2 , bit4, bit5, bit7 - bit15 are for d->format_unit()
*/ */
void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag) void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
{ {
@ -615,7 +615,7 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
d->cancel = 0; d->cancel = 0;
d->busy = BURN_DRIVE_FORMATTING; d->busy = BURN_DRIVE_FORMATTING;
ret = d->format_unit(d, size, flag & 0xff96); /* forward bits */ ret = d->format_unit(d, size, flag & 0xffb6); /* forward bits */
if (ret <= 0) if (ret <= 0)
d->cancel = 1; d->cancel = 1;

View File

@ -1166,11 +1166,15 @@ void burn_read_opts_free(struct burn_read_opts *opts);
void burn_disc_erase(struct burn_drive *drive, int fast); void burn_disc_erase(struct burn_drive *drive, int fast);
/* ts A70101 - A70112 */ /* ts A70101 - A70417 */
/** Format media for use with libburn. This currently applies to DVD-RW /** Format media for use with libburn. This currently applies to DVD-RW
in state "Sequential Recording" (profile 0014h) which get formatted to in state "Sequential Recording" (profile 0014h) which get formatted to
state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced" state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced"
by setting bit2 of flag. Other media cannot be formatted yet. by setting bit2 of flag. Other media cannot be formatted yet.
This function usually returns while the drive is still in the process
of formatting. The formatting is done, when burn_drive_get_status()
returns BURN_DRIVE_IDLE. This may be immediately after return or may
need several thousand seconds to occur.
@param drive The drive with the disc to format. @param drive The drive with the disc to format.
@param size The size in bytes to be used with the format command. It should @param size The size in bytes to be used with the format command. It should
be divisible by 32*1024. The effect of this parameter may be divisible by 32*1024. The effect of this parameter may
@ -1179,14 +1183,17 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
bit0= after formatting, write the given number of zero-bytes bit0= after formatting, write the given number of zero-bytes
to the media and eventually perform preliminary closing. to the media and eventually perform preliminary closing.
bit1= insist in size 0 even if there is a better default known bit1= insist in size 0 even if there is a better default known
bit2= format to maximum available size bit2= without bit7: format to maximum available size
with bit7 : take size from indexed format descriptor
bit3= -reserved- bit3= -reserved-
bit4= enforce re-format of (partly) formatted media bit4= enforce re-format of (partly) formatted media
bit5= try to disable eventual defect management
bit7= MMC expert application mode (else libburn tries to bit7= MMC expert application mode (else libburn tries to
choose a suitable format type): choose a suitable format type):
bit8 to bit15 contain the index of the format to use. See bit8 to bit15 contain the index of the format to use. See
burn_disc_get_formats(), burn_disc_get_format_descr(). burn_disc_get_formats(), burn_disc_get_format_descr().
Acceptable types are: 0x00, 0x10, 0x11, 0x13, 0x15, 0x26. Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13,
0x15, 0x26, 0x30, 0x31.
If bit7 is set, bit4 is set automatically. If bit7 is set, bit4 is set automatically.
*/ */
void burn_disc_format(struct burn_drive *drive, off_t size, int flag); void burn_disc_format(struct burn_drive *drive, off_t size, int flag);

View File

@ -2564,6 +2564,7 @@ int mmc_read_buffer_capacity(struct burn_drive *d)
bit2= format to maximum available size bit2= format to maximum available size
bit3= expand format up to at least size bit3= expand format up to at least size
bit4= enforce re-format of (partly) formatted media bit4= enforce re-format of (partly) formatted media
bit5= try to disable eventual defect management
bit7= bit8 to bit15 contain the index of the format to use bit7= bit8 to bit15 contain the index of the format to use
bit8-bit15 = see bit7 bit8-bit15 = see bit7
*/ */
@ -2572,8 +2573,8 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
struct buffer buf; struct buffer buf;
struct command c; struct command c;
int ret, tolerate_failure = 0, return_immediately = 0, i, format_type; int ret, tolerate_failure = 0, return_immediately = 0, i, format_type;
int index; int index, format_sub_type = 0;
off_t num_of_blocks = 0, diff; off_t num_of_blocks = 0, diff, format_size;
char msg[160],descr[80]; char msg[160],descr[80];
int full_format_type = 0x00; /* Full Format (or 0x10 for DVD-RW ?) */ int full_format_type = 0x00; /* Full Format (or 0x10 for DVD-RW ?) */
@ -2605,7 +2606,7 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
if (ret <= 0) if (ret <= 0)
goto selected_not_suitable; goto selected_not_suitable;
index = (flag >> 8) & 0xff; index = (flag >> 8) & 0xff;
if(index < 0 || index > d->num_format_descr) { if(index < 0 || index >= d->num_format_descr) {
selected_not_suitable:; selected_not_suitable:;
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020132, 0x00020132,
@ -2617,14 +2618,16 @@ selected_not_suitable:;
if (!(d->current_profile == 0x13 || if (!(d->current_profile == 0x13 ||
d->current_profile == 0x14 || d->current_profile == 0x14 ||
d->current_profile == 0x1a || d->current_profile == 0x1a ||
(0 && d->current_profile == 0x12) || d->current_profile == 0x12 ||
(0 && d->current_profile == 0x43))) /* >>> */ (0 && d->current_profile == 0x43))) /* >>> */
goto unsuitable_media; goto unsuitable_media;
format_type = d->format_descriptors[index].type; format_type = d->format_descriptors[index].type;
if (!(format_type == 0x00 || format_type == 0x10 || if (!(format_type == 0x00 || format_type == 0x01 ||
format_type == 0x10 ||
format_type == 0x11 || format_type == 0x13 || format_type == 0x11 || format_type == 0x13 ||
format_type == 0x15 || format_type == 0x26)) format_type == 0x15 || format_type == 0x26 ||
format_type == 0x30 || format_type == 0x31 ))
goto selected_not_suitable; goto selected_not_suitable;
if (flag & 4) { if (flag & 4) {
num_of_blocks = num_of_blocks =
@ -2734,6 +2737,7 @@ selected_not_suitable:;
} }
} else { } else {
no_suitable_formatting_type:;
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020131, 0x00020131,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
@ -2747,15 +2751,46 @@ selected_not_suitable:;
format_type == 0x15 ? "quick" : "full"); format_type == 0x15 ? "quick" : "full");
return_immediately = 1; /* caller must do the waiting */ return_immediately = 1; /* caller must do the waiting */
} else if (0 && d->current_profile == 0x12) { } else if (d->current_profile == 0x12) {
/* DVD-RAM */ /* ts A80417 : DVD-RAM */
format_type = 0x00; index = -1;
if(flag & 4) { format_size = -1;
/* >>> search for largest 0x00 format descriptor */; for (i = 0; i < d->num_format_descr; i++) {
} else { format_type = d->format_descriptors[i].type;
/* >>> search for smallest 0x00 descriptor >= size */; if (format_type!=0x00 && format_type!=0x01)
continue;
if(flag & (4 | 32)) { /* Max size or no defect mgt */
/* Search for largest 0x00 or 0x01
format descriptor */;
if (d->format_descriptors[i].size>format_size){
format_size =
d->format_descriptors[i].size;
index = i;
}
} else {
/* Search for smallest 0x0 or 0x01
descriptor >= size */;
if (d->format_descriptors[i].size >= size &&
(format_size < 0 ||
d->format_descriptors[i].size<format_size)
) {
format_size =
d->format_descriptors[i].size;
index = i;
}
}
} }
/* >>> */; if(index < 0)
goto no_suitable_formatting_type;
format_type = d->format_descriptors[index].type;
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++)
c.page->data[9 + i] =
( d->format_descriptors[index].tdp >>
(16 - 8 * i)) & 0xff;
sprintf(descr, "%s", d->current_profile_text);
return_immediately = 1; /* caller must do the waiting */
} else if (0 && d->current_profile == 0x43 && } else if (0 && d->current_profile == 0x43 &&
burn_support_untested_profiles) { burn_support_untested_profiles) {
@ -2784,7 +2819,7 @@ unsuitable_media:;
msg, 0, 0); msg, 0, 0);
return 0; return 0;
} }
c.page->data[8] = format_type << 2; c.page->data[8] = (format_type << 2) | (format_sub_type & 3);
sprintf(msg, "Format type %2.2Xh \"%s\", blocks = %.f\n", sprintf(msg, "Format type %2.2Xh \"%s\", blocks = %.f\n",
format_type, descr, (double) num_of_blocks); format_type, descr, (double) num_of_blocks);
@ -2792,6 +2827,17 @@ unsuitable_media:;
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg, 0, 0); msg, 0, 0);
/* <<<
*/
if(d->current_profile == 0x12 || d->current_profile == 0x43) {
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000002,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_ZERO,
"Formatting of DVD-RAM or BD-RE not implemented yet",
0, 0);
return 1;
}
d->issue_command(d, &c); d->issue_command(d, &c);
if (c.error && !tolerate_failure) { if (c.error && !tolerate_failure) {
if (c.sense[2]!=0) { if (c.sense[2]!=0) {