From c7f023c4d7e5544002f68583889f4acb0eb91847 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:33:28 -0500 Subject: first attempt at gpib listening - may not be functional --- globals.c | 3 ++- globals.h | 3 +++ gpib.c | 4 ++-- instr-daemon.c | 16 +++++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/globals.c b/globals.c index c18b788..d63aa2e 100644 --- a/globals.c +++ b/globals.c @@ -11,8 +11,9 @@ GlobalStruct globals = { .Registers.last_relay_driver_settings[0] = -1, .Registers.last_relay_driver_settings[1] = -1, - .Registers.last_relay_driver_settings[2] = -1 + .Registers.last_relay_driver_settings[2] = -1, + .Registers.gpib_buffer[0] = 0 }; diff --git a/globals.h b/globals.h index 3f5bdff..13b6cc9 100644 --- a/globals.h +++ b/globals.h @@ -274,6 +274,8 @@ long sec_timer (void); unsigned long long ms_timer (void); +#define max_gpib_input_length 512 + typedef struct { int parallel_DAC_reg[8]; long shift_reg_out[num_out_SRs]; @@ -282,6 +284,7 @@ typedef struct { int ques_enable_register; /* for stat:enable command */ int avrq_reg; int last_rise_time_relay_setting; + char gpib_buffer[max_gpib_input_length]; } HWregStruct; diff --git a/gpib.c b/gpib.c index 2533787..32e9074 100644 --- a/gpib.c +++ b/gpib.c @@ -9,7 +9,7 @@ /* I/O */ -#define max_input_length 512 +#define max_gpib_input_length 512 #define READ_EOS_BYTE 0x00 /* EOS byte for reads/inputs/receives*/ #define WRITE_EOS_BYTE 0x00 /* EOS byte for writes/outputs/sends */ @@ -657,7 +657,7 @@ int GPIB_check_for_messages(char *gpib_buf) /* if no I/O is begin done, set up for input. Note that TLCHLTE must be set to zero, so that the */ /* HALT signal is set only by the STOP and GO commands. */ if (TNT_In(R_sts1)&B_halt) { - cnt=max_input_length-8; + cnt=max_gpib_input_length-8; gpib_buf[0]=0; INTERFACE_STATUS=0; TNT_Setup_IO(INPUT,cnt,EOI|EOS); diff --git a/instr-daemon.c b/instr-daemon.c index f1b1a6d..093b2f7 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -8,6 +8,9 @@ #include "nicutils.h" #include "monitor.h" #include "menus.h" +#include "gpib.h" +#include "parser.h" + #include #include #include @@ -222,7 +225,7 @@ int main(int argc, char **argv) LCD_write(2,0,message); g_free (message); - // FIXME - init RS232 + GPIB_initialize(); IO_Setup_RS232( globals.Flash.baud, globals.Flash.parity, @@ -317,5 +320,16 @@ static gboolean periodic_poll (void) Menu_Check_Buttons (); + // FIXME - gpib input - should have it's own thread? + GPIB_check_for_device_clear_signal(); + if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { + if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { + // check_for_ctrl_mode_changes(); /* update rem/loc settings */ + Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); + } + } + GPIB_check_for_device_clear_signal(); + + return TRUE; } -- cgit