mirror of
https://github.com/simh/simh.git
synced 2026-02-09 17:52:36 +00:00
ALL: Standardize writelock behavior adding global UNIT_WLK & UNIT_WPRT
Historically this functionality was reimplemented within each DEVICE simulator often with slightly different implementations and inconsistencies. Solving this globally within SCP required changes in many places, but should henceforth be reasonably managed. As discussed in #1034
This commit is contained in:
11
sim_scsi.c
11
sim_scsi.c
@@ -1578,6 +1578,9 @@ bus->dev[id] = uptr;
|
||||
void scsi_set_unit (SCSI_BUS *bus, UNIT *uptr, SCSI_DEV *dev)
|
||||
{
|
||||
uptr->up7 = (void *)dev;
|
||||
|
||||
if (dev->devtype == SCSI_CDROM)
|
||||
set_writelock (uptr, 1, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Reset a unit */
|
||||
@@ -1677,14 +1680,18 @@ switch (dev->devtype) {
|
||||
|
||||
t_stat scsi_set_wlk (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
{
|
||||
return SCPE_OK;
|
||||
SCSI_DEV *dev = (SCSI_DEV *)uptr->up7;
|
||||
|
||||
if ((dev->devtype == SCSI_CDROM) && (val == 0))
|
||||
return sim_messagef (SCPE_ARG, "%s: Can't write enable CDROM device\n", sim_uname (uptr));
|
||||
return set_writelock (uptr, val, cptr, desc);
|
||||
}
|
||||
|
||||
/* Show write lock status */
|
||||
|
||||
t_stat scsi_show_wlk (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
{
|
||||
return SCPE_OK;
|
||||
return show_writelock (st, uptr, val, desc);
|
||||
}
|
||||
|
||||
/* Attach device */
|
||||
|
||||
Reference in New Issue
Block a user