summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-26 15:14:53 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-26 15:14:53 -0400
commiteec87f54328d64828fd37575f18b23430b670485 (patch)
tree25cbd9045be9196ebf7f7982e897e52ce198ab63
parent82e549f79c290d6a97cf9161476eeb58cb564da3 (diff)
initial addition of gpib driver
-rw-r--r--CMakeLists.txt1
-rw-r--r--bus.c8
-rw-r--r--dummy_functions.c26
-rw-r--r--dummy_functions.h14
-rw-r--r--error_utils.c2
-rw-r--r--error_utils.h1
-rw-r--r--globals.h13
-rw-r--r--menus.c2
-rw-r--r--parser.c2
9 files changed, 8 insertions, 61 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4656a4..5ba415d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ add_executable(instr-daemon instr-daemon.c
monitor.c
menus.c
dummy_functions.c
+ gpib.c
)
add_executable(instr-client instr-client.c)
diff --git a/bus.c b/bus.c
index dfa10ba..a860893 100644
--- a/bus.c
+++ b/bus.c
@@ -326,7 +326,7 @@ static unsigned gpio_pins[] = { GPIO0_X + 22, // i.e., GPIO0_22
GPIO1_X + 15, // i.e., GPIO1_15
GPIO1_X + 14,
GPIO0_X + 27,
- GPIO1_X + 12
+ GPIO1_X + 12
};
@@ -367,9 +367,9 @@ void bus_init()
int bus_getpin(int pin)
{
- if (isbb) {
- return gpio_readvalue(gpio_pins[pin]);
- } else {
+ if (isbb) {
+ return gpio_readvalue(gpio_pins[pin]);
+ } else {
return 0;
}
}
diff --git a/dummy_functions.c b/dummy_functions.c
index 8f10b94..71d6b59 100644
--- a/dummy_functions.c
+++ b/dummy_functions.c
@@ -1,31 +1,5 @@
#include "dummy_functions.h"
#include "globals.h"
-void GPIB_Set_Command_Error() {}
-void GPIB_Set_Query_Error() {}
-void GPIB_Set_Device_Dependent_Error() {}
-void GPIB_Set_Execution_Error() {}
-unsigned int GPIB_get_ESR ()
-{
- return 0;
-}
-unsigned int GPIB_get_SRE ()
-{
- return 0;
-}
-unsigned int GPIB_get_ESE ()
-{
- return 0;
-}
-unsigned int GPIB_get_STB ()
-{
- return 0;
-}
-void GPIB_set_ESR (unsigned int byte,int operation) {}
-void GPIB_set_SRE (unsigned int byte,int operation) {}
-void GPIB_set_ESE (unsigned int byte,int operation) {}
-void GPIB_clear_events () {}
-void GPIB_change_address(int new_address) {}
-
void Main_return_to_local() {}
diff --git a/dummy_functions.h b/dummy_functions.h
index 15cfb1b..5f9ba2e 100644
--- a/dummy_functions.h
+++ b/dummy_functions.h
@@ -3,20 +3,6 @@
#include "globals.h"
-void GPIB_Set_Command_Error();
-void GPIB_Set_Query_Error();
-void GPIB_Set_Device_Dependent_Error();
-void GPIB_Set_Execution_Error();
-unsigned int GPIB_get_ESR ();
-unsigned int GPIB_get_SRE ();
-unsigned int GPIB_get_ESE ();
-unsigned int GPIB_get_STB ();
-void GPIB_set_ESR (unsigned int byte,int operation);
-void GPIB_set_SRE (unsigned int byte,int operation);
-void GPIB_set_ESE (unsigned int byte,int operation);
-void GPIB_clear_events ();
-void GPIB_change_address(int new_address);
-
void Main_return_to_local();
#endif
diff --git a/error_utils.c b/error_utils.c
index 32ea779..f0e889c 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -120,8 +120,6 @@ void queue_error_from_parser(gchar** response, int error_num)
}
-void queue_error_for_gpib_only(int error_num);
-
void queue_error_for_gpib_only(int error_num)
{
if (error_num == OK) {
diff --git a/error_utils.h b/error_utils.h
index ac03fd9..a331b18 100644
--- a/error_utils.h
+++ b/error_utils.h
@@ -11,5 +11,6 @@ void Error_Remove_From_Queue(void);
int Error_check(ChannelStruct ChannelStateToTest[max_channels]);
void queue_and_broadcast_sensor_alarm(int error_num);
void queue_error_and_display_on_LCD(int error_num);
+void queue_error_for_gpib_only(int error_num);
#endif
diff --git a/globals.h b/globals.h
index bed0eef..3f5bdff 100644
--- a/globals.h
+++ b/globals.h
@@ -273,18 +273,6 @@
long sec_timer (void);
unsigned long long ms_timer (void);
-typedef struct {
- int PRIMARY_ADDRESS; /* GPIB chip's GPIB primary address */
- int INTERFACE_ERROR; /* Error Code */
- int INTERFACE_STATUS; /* Interface Status */
- unsigned int MR_4882_status[5]; /* 4882 status memory registers */
- unsigned long int DATA_COUNT; /* Transfer count */
- unsigned long int Requested_Count; /* Requested transfer count */
- unsigned long int cnt;
- int prev_brq;
- int spoll_count;
-} GpibStruct;
-
typedef struct {
int parallel_DAC_reg[8];
@@ -795,7 +783,6 @@ typedef struct {
ConstraintsStruct Constraints;
ChannelStruct ChannelState[max_channels];
FlashStruct Flash;
- GpibStruct GPIB;
HWregStruct Registers;
ChangeStruct Changes;
ErrorStruct Errors;
diff --git a/menus.c b/menus.c
index b26493b..90e921b 100644
--- a/menus.c
+++ b/menus.c
@@ -1217,7 +1217,7 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
break;
case Show_gpib_address:
- Submenu_Value=(float) globals.GPIB.PRIMARY_ADDRESS;
+ Submenu_Value=(float) globals.Flash.gpib_address;
significant_digits=0;
units = g_strdup("");
show_plus_sign=NO;
diff --git a/parser.c b/parser.c
index 32f8d53..e502273 100644
--- a/parser.c
+++ b/parser.c
@@ -2715,7 +2715,7 @@ static int Go_gpib_addr_59(gchar** response, int channel, char *parameter,char *
break;
case query_simple:
- return query_int (response, globals.GPIB.PRIMARY_ADDRESS);
+ return query_int (response, globals.Flash.gpib_address);
break;
case query_param: