Skip to content

Commit

Permalink
ZuluSCSI_disk: rename doRead() -> scsiDiskStartRead()
Browse files Browse the repository at this point in the history
Allows delegating to this code from the separate cdrom
command implementations.
  • Loading branch information
PetteriAimonen authored and erichelgeson committed May 14, 2023
1 parent 562ef30 commit 8a3fd63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/BlueSCSI_disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ static struct {
/* Write command */
/*****************/

static void doWrite(uint32_t lba, uint32_t blocks)
void scsiDiskStartWrite(uint32_t lba, uint32_t blocks)
{
if (unlikely(scsiDev.target->cfg->deviceType == S2S_CFG_FLOPPY_14MB)) {
// Floppies are supposed to be slow. Some systems can't handle a floppy
Expand Down Expand Up @@ -1166,7 +1166,7 @@ void diskDataOut()
/* Read command */
/*****************/

static void doRead(uint32_t lba, uint32_t blocks)
void scsiDiskStartRead(uint32_t lba, uint32_t blocks)
{
if (unlikely(scsiDev.target->cfg->deviceType == S2S_CFG_FLOPPY_14MB)) {
// Floppies are supposed to be slow. Some systems can't handle a floppy
Expand Down Expand Up @@ -1451,7 +1451,7 @@ int scsiDiskCommand()
scsiDev.cdb[3];
uint32_t blocks = scsiDev.cdb[4];
if (unlikely(blocks == 0)) blocks = 256;
doRead(lba, blocks);
scsiDiskStartRead(lba, blocks);
}
else if (likely(command == 0x28))
{
Expand All @@ -1467,7 +1467,7 @@ int scsiDiskCommand()
(((uint32_t) scsiDev.cdb[7]) << 8) +
scsiDev.cdb[8];

doRead(lba, blocks);
scsiDiskStartRead(lba, blocks);
}
else if (likely(command == 0x0A))
{
Expand All @@ -1478,7 +1478,7 @@ int scsiDiskCommand()
scsiDev.cdb[3];
uint32_t blocks = scsiDev.cdb[4];
if (unlikely(blocks == 0)) blocks = 256;
doWrite(lba, blocks);
scsiDiskStartWrite(lba, blocks);
}
else if (likely(command == 0x2A) || // WRITE(10)
unlikely(command == 0x2E)) // WRITE AND VERIFY
Expand All @@ -1496,7 +1496,7 @@ int scsiDiskCommand()
(((uint32_t) scsiDev.cdb[7]) << 8) +
scsiDev.cdb[8];

doWrite(lba, blocks);
scsiDiskStartWrite(lba, blocks);
}
else if (unlikely(command == 0x04))
{
Expand Down
5 changes: 5 additions & 0 deletions src/BlueSCSI_disk.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ bool scsiDiskGetImageNameFromConfig(image_config_t &img, char *buf, size_t bufle
// Get pointer to extended image configuration based on target idx
image_config_t &scsiDiskGetImageConfig(int target_idx);

// Start data transfer from disk image to SCSI bus
// Can be called by device type specific command implementations (such as READ CD)
void scsiDiskStartRead(uint32_t lba, uint32_t blocks);

// Start data transfer from SCSI bus to disk image
void scsiDiskStartWrite(uint32_t lba, uint32_t blocks);

0 comments on commit 8a3fd63

Please sign in to comment.