Applied the latest PCem commits.

This commit is contained in:
OBattler
2018-03-21 15:16:25 +01:00
parent 8e22d282d1
commit 0f06407825
5 changed files with 261 additions and 100 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the Iomega ZIP drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage.
*
* Version: @(#)zip.c 1.0.17 2018/03/20
* Version: @(#)zip.c 1.0.19 2018/03/21
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -99,7 +99,9 @@ const uint8_t zip_command_flags[0x100] =
0,
IMPLEMENTED, /* 0x1D */
IMPLEMENTED | CHECK_READY, /* 0x1E */
0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
IMPLEMENTED | ATAPI_ONLY, /* 0x23 */
0,
IMPLEMENTED | CHECK_READY, /* 0x25 */
0, 0,
IMPLEMENTED | CHECK_READY, /* 0x28 */
@@ -1988,7 +1990,7 @@ atapi_out:
zip_buf_free(id);
return;
}
zip_set_buf_len(id, BufLen, &len);
zip_data_command_finish(id, len, len, len, 0);
@@ -2000,6 +2002,70 @@ atapi_out:
zip_command_complete(id);
break;
case GPCMD_READ_FORMAT_CAPACITIES:
len = (cdb[7] << 8) | cdb[8];
zip_buf_alloc(id, len);
memset(zipbufferb, 0, len);
pos = 0;
/* List header */
zipbufferb[pos++] = 0;
zipbufferb[pos++] = 0;
zipbufferb[pos++] = 0;
if (zip_drives[id].f != NULL)
zipbufferb[pos++] = 16;
else
zipbufferb[pos++] = 8;
/* Current/Maximum capacity header */
if (zip_drives[id].is_250) {
if (zip_drives[id].f != NULL) {
zipbufferb[pos++] = (zip_drives[id].medium_size >> 24) & 0xff;
zipbufferb[pos++] = (zip_drives[id].medium_size >> 16) & 0xff;
zipbufferb[pos++] = (zip_drives[id].medium_size >> 8) & 0xff;
zipbufferb[pos++] = zip_drives[id].medium_size & 0xff;
zipbufferb[pos++] = 2; /* Current medium capacity */
} else {
zipbufferb[pos++] = (ZIP_250_SECTORS >> 24) & 0xff;
zipbufferb[pos++] = (ZIP_250_SECTORS >> 16) & 0xff;
zipbufferb[pos++] = (ZIP_250_SECTORS >> 8) & 0xff;
zipbufferb[pos++] = ZIP_250_SECTORS & 0xff;
zipbufferb[pos++] = 3; /* Maximum medium capacity */
}
} else {
zipbufferb[pos++] = (ZIP_SECTORS >> 24) & 0xff;
zipbufferb[pos++] = (ZIP_SECTORS >> 16) & 0xff;
zipbufferb[pos++] = (ZIP_SECTORS >> 8) & 0xff;
zipbufferb[pos++] = ZIP_SECTORS & 0xff;
if (zip_drives[id].f != NULL)
zipbufferb[pos++] = 2;
else
zipbufferb[pos++] = 3;
}
zipbufferb[pos++] = 512 >> 16;
zipbufferb[pos++] = 512 >> 8;
zipbufferb[pos++] = 512 & 0xff;
if (zip_drives[id].f != NULL) {
/* Formattable capacity descriptor */
zipbufferb[pos++] = (zip_drives[id].medium_size >> 24) & 0xff;
zipbufferb[pos++] = (zip_drives[id].medium_size >> 16) & 0xff;
zipbufferb[pos++] = (zip_drives[id].medium_size >> 8) & 0xff;
zipbufferb[pos++] = zip_drives[id].medium_size & 0xff;
zipbufferb[pos++] = 0;
zipbufferb[pos++] = 512 >> 16;
zipbufferb[pos++] = 512 >> 8;
zipbufferb[pos++] = 512 & 0xff;
}
zip_set_buf_len(id, BufLen, &len);
zip_data_command_finish(id, len, len, len, 0);
break;
default:
zip_illegal_opcode(id);
break;