summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--globals.c3
-rw-r--r--globals.h3
-rw-r--r--gpib.c4
-rw-r--r--instr-daemon.c16
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 <stdlib.h>
#include <ctype.h>
#include <glib.h>
@@ -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;
}