Added a device flag which can be used to avoid auto detach at device attach time.

This commit is contained in:
Mark Pizzolato 2013-06-17 21:17:49 -07:00
parent e13b1fed55
commit 97eb58cfc4
2 changed files with 11 additions and 6 deletions

7
scp.c
View file

@ -3656,12 +3656,15 @@ if (dptr == NULL) /* found dev? */
return SCPE_NXDEV; return SCPE_NXDEV;
if (uptr == NULL) /* valid unit? */ if (uptr == NULL) /* valid unit? */
return SCPE_NXUN; return SCPE_NXUN;
if ((uptr->flags & UNIT_ATT) && /* already attached? */ if (uptr->flags & UNIT_ATT) /* already attached? */
!(uptr->dynflags & UNIT_ATTMULT)) { /* and only single attachable */ if (!(uptr->dynflags & UNIT_ATTMULT) && /* and only single attachable */
!(dptr->flags & DEV_DONTAUTO)) { /* and auto detachable */
r = scp_detach_unit (dptr, uptr); /* detach it */ r = scp_detach_unit (dptr, uptr); /* detach it */
if (r != SCPE_OK) /* error? */ if (r != SCPE_OK) /* error? */
return r; return r;
} }
else
return SCPE_ALATT; /* Already attached */
sim_trim_endspc (cptr); /* trim trailing spc */ sim_trim_endspc (cptr); /* trim trailing spc */
return scp_attach_unit (dptr, uptr, cptr); /* attach */ return scp_attach_unit (dptr, uptr, cptr); /* attach */
} }

View file

@ -384,6 +384,7 @@ struct sim_device {
#define DEV_V_TYPE 4 /* Attach type */ #define DEV_V_TYPE 4 /* Attach type */
#define DEV_S_TYPE 3 /* Width of Type Field */ #define DEV_S_TYPE 3 /* Width of Type Field */
#define DEV_V_SECTORS 7 /* Unit Capacity is in 512byte sectors */ #define DEV_V_SECTORS 7 /* Unit Capacity is in 512byte sectors */
#define DEV_V_DONTAUTO 8 /* Do not auto detach already attached units */
#define DEV_V_UF_31 12 /* user flags, V3.1 */ #define DEV_V_UF_31 12 /* user flags, V3.1 */
#define DEV_V_UF 16 /* user flags */ #define DEV_V_UF 16 /* user flags */
#define DEV_V_RSV 31 /* reserved */ #define DEV_V_RSV 31 /* reserved */
@ -393,6 +394,7 @@ struct sim_device {
#define DEV_DYNM (1 << DEV_V_DYNM) /* device requires call on msize routine to change memory size */ #define DEV_DYNM (1 << DEV_V_DYNM) /* device requires call on msize routine to change memory size */
#define DEV_DEBUG (1 << DEV_V_DEBUG) /* device supports SET DEBUG command */ #define DEV_DEBUG (1 << DEV_V_DEBUG) /* device supports SET DEBUG command */
#define DEV_SECTORS (1 << DEV_V_SECTORS) /* capacity is 512 byte sectors */ #define DEV_SECTORS (1 << DEV_V_SECTORS) /* capacity is 512 byte sectors */
#define DEV_DONTAUTO (1 << DEV_V_DONTAUTO) /* Do not auto detach already attached units */
#define DEV_NET 0 /* Deprecated - meaningless */ #define DEV_NET 0 /* Deprecated - meaningless */