Skip to content

Commit

Permalink
ETHER: Make sure SET NOASYNC is effective for Ethernet devices
Browse files Browse the repository at this point in the history
- Make sure that asynchronous mode can't be changed if devices using
   sim_ether are already attached.
- Add missing DEV_ETHER type flag for the only sim_ether using device
   that didn't already have it.
  • Loading branch information
markpizz authored and pkoning2 committed Feb 1, 2024
1 parent b273cac commit 7a6a325
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VAX/vax_xs.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ DEVICE xs_dev = {
1, DEV_RDX, 20, 1, DEV_RDX, 8,
NULL, NULL, &xs_reset,
NULL, &xs_attach, &xs_detach,
&xs_dib, DEV_DEBUG | XS_FLAGS, 0,
&xs_dib, DEV_DEBUG | XS_FLAGS | DEV_ETHER, 0,
xs_debug, NULL, NULL, &xs_help, NULL, NULL,
&xs_description
};
Expand Down
10 changes: 10 additions & 0 deletions scp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5767,6 +5767,16 @@ if (cptr && (*cptr != 0)) /* now eol? */
#ifdef SIM_ASYNCH_IO
if (flag == sim_asynch_enabled) /* already set correctly? */
return SCPE_OK;
if (1) {
uint32 i;
DEVICE *dptr;

for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* flush attached files */
if ((DEV_TYPE(dptr) == DEV_ETHER) &&
(dptr->units->flags & UNIT_ATT))
return sim_messagef (SCPE_ALATT, "Can't change asynch mode with %s device attached\n", dptr->name);
}
}
sim_asynch_enabled = flag;
tmxr_change_async ();
sim_timer_change_asynch ();
Expand Down
10 changes: 9 additions & 1 deletion sim_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,10 @@ return NULL;
}
#endif

/* eth_set_async
*
* Turn on reciever processing which can be either asynchronous or polled
*/
t_stat eth_set_async (ETH_DEV *dev, int latency)
{
#if !defined(USE_READER_THREAD) || !defined(SIM_ASYNCH_IO)
Expand All @@ -2186,7 +2190,7 @@ return sim_messagef (SCPE_NOFNC, "%s", msg);
#else
int wakeup_needed;

dev->asynch_io = 1;
dev->asynch_io = sim_asynch_enabled;
dev->asynch_io_latency = latency;
pthread_mutex_lock (&dev->lock);
wakeup_needed = (dev->read_queue.count != 0);
Expand All @@ -2199,6 +2203,10 @@ if (wakeup_needed) {
return SCPE_OK;
}

/* eth_clr_async
*
* Turn off reciever processing
*/
t_stat eth_clr_async (ETH_DEV *dev)
{
#if !defined(USE_READER_THREAD) || !defined(SIM_ASYNCH_IO)
Expand Down

0 comments on commit 7a6a325

Please sign in to comment.