diff options
-rw-r--r-- | globals.c | 4 | ||||
-rw-r--r-- | globals.h | 7 | ||||
-rw-r--r-- | instr-daemon.c | 23 |
3 files changed, 28 insertions, 6 deletions
@@ -13,7 +13,9 @@ GlobalStruct globals = { .Registers.last_relay_driver_settings[1] = -1, .Registers.last_relay_driver_settings[2] = -1, - .Registers.gpib_buffer[0] = 0 + .Registers.gpib_buffer[0] = 0, + + .4882Locks.locked_network_server = NO_SERVER_LOCKED }; @@ -779,6 +779,12 @@ typedef struct { } HWDetectStruct; +#define NO_SERVER_LOCKED -1 +typedef struct { + int command_in_progress; + int locked_network_server; +} LockStruct; + typedef struct { ConstraintsStruct Constraints; ChannelStruct ChannelState[max_channels]; @@ -793,6 +799,7 @@ typedef struct { MenuStatusStruct MenuStatus; RemoteStruct Remote; HWDetectStruct HWDetect; + LockStruct 4882Locks; } GlobalStruct; diff --git a/instr-daemon.c b/instr-daemon.c index ec70f97..2097a6c 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -403,13 +403,26 @@ static gboolean periodic_poll (void) Update_Main_Menu_If_Visible(); - GPIB_check_for_device_clear_signal(); - if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { - if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { - Parser_main(globals.Registers.gpib_buffer, 0, GPIB_send_query_response, NULL); + // don't check GPIB interface if a VXI interface is locked, + // or is currently handling a command + + if ((globals.4882Locks.locked_network_server == NO_SERVER_LOCKED) && + (globals.4882Locks.command_in_progress == FALSE)) { + + // tell VXI servers that the 4882 subsystem is busy + globals.4882Locks.command_in_progress = TRUE; + + GPIB_check_for_device_clear_signal(); + if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { + if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { + Parser_main(globals.Registers.gpib_buffer, 0, GPIB_send_query_response, NULL); + } } + GPIB_check_for_device_clear_signal(); + + // tell VXI servers that the 4882 subsystem is avilable again + globals.4882Locks.command_in_progress = FALSE; } - GPIB_check_for_device_clear_signal(); Update_Main_Menu_If_Visible(); } |