From 9f693eba66b3ff9934050fd4b5c50b7660cc3096 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Thu, 11 Oct 2012 12:44:56 -0400 Subject: better test for TNT4882 presence --- gpib.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/gpib.c b/gpib.c index 091aef6..1ad96ca 100644 --- a/gpib.c +++ b/gpib.c @@ -202,6 +202,8 @@ #define R_misc 0x15 #define R_sts1 0x10 +#define R_sts2 0x1c + #define B_halt (1<<1) #define R_cfg 0x10 @@ -421,18 +423,17 @@ void GPIB_initialize(void) DATA_COUNT=0; Requested_Count=0; - TNT_Out(R_cmdr,F_softreset); /* Reset FIFOS */ + // test to detect TNT chip + if ((TNT_In(R_sts2) & 0xB0) == 0x90) { + is_gpib = 1; + } else { + is_gpib = 0; + printf ("Error: TNT4882 chip not found\n"); + return; + } + TNT_Out(R_cmdr,F_softreset); /* Reset FIFOS */ TNT_Out(R_spmr ,0x80); /* This sequence of commands */ - - if (TNT_In(R_spmr) == 0x80) { - is_gpib = 1; - } else { - is_gpib = 0; - printf ("Error: TNT4882 chip not found\n"); - return; - } - TNT_Out(R_auxmr,0x80); /* insures that the TNT */ TNT_Out(R_auxmr,0x99); /* will be in the normal 7210 */ TNT_Out(R_keyrg,0); /* mode and not 9914 */ -- cgit