1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

ETHER: Make sure SET NOASYNC is effective for Ethernet devices

- 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.
This commit is contained in:
Mark Pizzolato 2024-01-06 14:43:21 -10:00
parent 54f55777f5
commit 4dfb3508bf
3 changed files with 20 additions and 2 deletions

View File

@ -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
};

10
scp.c
View File

@ -6109,6 +6109,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;
sim_timer_change_asynch ();
if (1) {

View File

@ -2218,6 +2218,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)
@ -2227,7 +2231,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);
@ -2240,6 +2244,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)