summaryrefslogtreecommitdiff
path: root/gpib.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-10-11 12:44:56 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-10-11 12:44:56 -0400
commit9f693eba66b3ff9934050fd4b5c50b7660cc3096 (patch)
treef565e6b0861f2211acd33aa43696931940705780 /gpib.c
parente2e3972a0a65dad53f99d8c1c92347cc1ac8dadb (diff)
better test for TNT4882 presence
Diffstat (limited to 'gpib.c')
-rw-r--r--gpib.c21
1 files 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 */