Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/drivers/gpib/tnt4882/tnt4882_gpib.c
38184 views
1
// SPDX-License-Identifier: GPL-2.0
2
3
/***************************************************************************
4
* National Instruments boards using tnt4882 or compatible chips (at-gpib, etc).
5
* copyright : (C) 2001, 2002 by Frank Mori Hess
6
***************************************************************************/
7
8
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
#define dev_fmt pr_fmt
10
#define DRV_NAME KBUILD_MODNAME
11
12
#include <linux/ioport.h>
13
#include <linux/sched.h>
14
#include <linux/module.h>
15
#include <linux/slab.h>
16
#include <linux/pci.h>
17
#include <linux/pci_ids.h>
18
#include <linux/string.h>
19
#include <linux/init.h>
20
#include <linux/delay.h>
21
#include <linux/isapnp.h>
22
23
#include "nec7210.h"
24
#include "gpibP.h"
25
#include "mite.h"
26
#include "tnt4882_registers.h"
27
28
static const int ISAPNP_VENDOR_ID_NI = ISAPNP_VENDOR('N', 'I', 'C');
29
static const int ISAPNP_ID_NI_ATGPIB_TNT = 0xc601;
30
enum {
31
PCI_DEVICE_ID_NI_GPIB = 0xc801,
32
PCI_DEVICE_ID_NI_GPIB_PLUS = 0xc811,
33
PCI_DEVICE_ID_NI_GPIB_PLUS2 = 0x71ad,
34
PCI_DEVICE_ID_NI_PXIGPIB = 0xc821,
35
PCI_DEVICE_ID_NI_PMCGPIB = 0xc831,
36
PCI_DEVICE_ID_NI_PCIEGPIB = 0x70cf,
37
PCI_DEVICE_ID_NI_PCIE2GPIB = 0x710e,
38
// Measurement Computing PCI-488 same design as PCI-GPIB with TNT5004
39
PCI_DEVICE_ID_MC_PCI488 = 0x7259,
40
PCI_DEVICE_ID_CEC_NI_GPIB = 0x7258
41
};
42
43
// struct which defines private_data for tnt4882 devices
44
struct tnt4882_priv {
45
struct nec7210_priv nec7210_priv;
46
struct mite_struct *mite;
47
struct pnp_dev *pnp_dev;
48
unsigned int irq;
49
unsigned short imr0_bits;
50
unsigned short imr3_bits;
51
unsigned short auxg_bits; // bits written to auxiliary register G
52
};
53
54
static irqreturn_t tnt4882_internal_interrupt(struct gpib_board *board);
55
56
// register offset for nec7210 compatible registers
57
static const int atgpib_reg_offset = 2;
58
59
// number of ioports used
60
static const int atgpib_iosize = 32;
61
62
/* paged io */
63
static inline unsigned int tnt_paged_readb(struct tnt4882_priv *priv, unsigned long offset)
64
{
65
iowrite8(AUX_PAGEIN, priv->nec7210_priv.mmiobase + AUXMR * priv->nec7210_priv.offset);
66
udelay(1);
67
return ioread8(priv->nec7210_priv.mmiobase + offset);
68
}
69
70
static inline void tnt_paged_writeb(struct tnt4882_priv *priv, unsigned int value,
71
unsigned long offset)
72
{
73
iowrite8(AUX_PAGEIN, priv->nec7210_priv.mmiobase + AUXMR * priv->nec7210_priv.offset);
74
udelay(1);
75
iowrite8(value, priv->nec7210_priv.mmiobase + offset);
76
}
77
78
/* readb/writeb wrappers */
79
static inline unsigned short tnt_readb(struct tnt4882_priv *priv, unsigned long offset)
80
{
81
void __iomem *address = priv->nec7210_priv.mmiobase + offset;
82
unsigned long flags;
83
unsigned short retval;
84
spinlock_t *register_lock = &priv->nec7210_priv.register_page_lock;
85
86
spin_lock_irqsave(register_lock, flags);
87
switch (offset) {
88
case CSR:
89
case SASR:
90
case ISR0:
91
case BSR:
92
switch (priv->nec7210_priv.type) {
93
case TNT4882:
94
case TNT5004:
95
retval = ioread8(address);
96
break;
97
case NAT4882:
98
retval = tnt_paged_readb(priv, offset - tnt_pagein_offset);
99
break;
100
case NEC7210:
101
retval = 0;
102
break;
103
default:
104
retval = 0;
105
break;
106
}
107
break;
108
default:
109
retval = ioread8(address);
110
break;
111
}
112
spin_unlock_irqrestore(register_lock, flags);
113
return retval;
114
}
115
116
static inline void tnt_writeb(struct tnt4882_priv *priv, unsigned short value, unsigned long offset)
117
{
118
void __iomem *address = priv->nec7210_priv.mmiobase + offset;
119
unsigned long flags;
120
spinlock_t *register_lock = &priv->nec7210_priv.register_page_lock;
121
122
spin_lock_irqsave(register_lock, flags);
123
switch (offset) {
124
case KEYREG:
125
case IMR0:
126
case BCR:
127
switch (priv->nec7210_priv.type) {
128
case TNT4882:
129
case TNT5004:
130
iowrite8(value, address);
131
break;
132
case NAT4882:
133
tnt_paged_writeb(priv, value, offset - tnt_pagein_offset);
134
break;
135
case NEC7210:
136
break;
137
default:
138
break;
139
}
140
break;
141
default:
142
iowrite8(value, address);
143
break;
144
}
145
spin_unlock_irqrestore(register_lock, flags);
146
}
147
148
MODULE_LICENSE("GPL");
149
MODULE_DESCRIPTION("GPIB driver for National Instruments boards using tnt4882 or compatible chips");
150
151
static int tnt4882_line_status(const struct gpib_board *board)
152
{
153
int status = VALID_ALL;
154
int bcsr_bits;
155
struct tnt4882_priv *tnt_priv;
156
157
tnt_priv = board->private_data;
158
159
bcsr_bits = tnt_readb(tnt_priv, BSR);
160
161
if (bcsr_bits & BCSR_REN_BIT)
162
status |= BUS_REN;
163
if (bcsr_bits & BCSR_IFC_BIT)
164
status |= BUS_IFC;
165
if (bcsr_bits & BCSR_SRQ_BIT)
166
status |= BUS_SRQ;
167
if (bcsr_bits & BCSR_EOI_BIT)
168
status |= BUS_EOI;
169
if (bcsr_bits & BCSR_NRFD_BIT)
170
status |= BUS_NRFD;
171
if (bcsr_bits & BCSR_NDAC_BIT)
172
status |= BUS_NDAC;
173
if (bcsr_bits & BCSR_DAV_BIT)
174
status |= BUS_DAV;
175
if (bcsr_bits & BCSR_ATN_BIT)
176
status |= BUS_ATN;
177
178
return status;
179
}
180
181
static int tnt4882_t1_delay(struct gpib_board *board, unsigned int nano_sec)
182
{
183
struct tnt4882_priv *tnt_priv = board->private_data;
184
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
185
unsigned int retval;
186
187
retval = nec7210_t1_delay(board, nec_priv, nano_sec);
188
if (nec_priv->type == NEC7210)
189
return retval;
190
191
if (nano_sec <= 350) {
192
tnt_writeb(tnt_priv, MSTD, KEYREG);
193
retval = 350;
194
} else {
195
tnt_writeb(tnt_priv, 0, KEYREG);
196
}
197
if (nano_sec > 500 && nano_sec <= 1100) {
198
write_byte(nec_priv, AUXRI | USTD, AUXMR);
199
retval = 1100;
200
} else {
201
write_byte(nec_priv, AUXRI, AUXMR);
202
}
203
return retval;
204
}
205
206
static int fifo_word_available(struct tnt4882_priv *tnt_priv)
207
{
208
int status2;
209
int retval;
210
211
status2 = tnt_readb(tnt_priv, STS2);
212
retval = (status2 & AEFN) && (status2 & BEFN);
213
214
return retval;
215
}
216
217
static int fifo_byte_available(struct tnt4882_priv *tnt_priv)
218
{
219
int status2;
220
int retval;
221
222
status2 = tnt_readb(tnt_priv, STS2);
223
retval = (status2 & AEFN) || (status2 & BEFN);
224
225
return retval;
226
}
227
228
static int fifo_xfer_done(struct tnt4882_priv *tnt_priv)
229
{
230
int status1;
231
int retval;
232
233
status1 = tnt_readb(tnt_priv, STS1);
234
retval = status1 & (S_DONE | S_HALT);
235
236
return retval;
237
}
238
239
static int drain_fifo_words(struct tnt4882_priv *tnt_priv, u8 *buffer, int num_bytes)
240
{
241
int count = 0;
242
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
243
244
while (fifo_word_available(tnt_priv) && count + 2 <= num_bytes) {
245
short word;
246
247
word = ioread16(nec_priv->mmiobase + FIFOB);
248
buffer[count++] = word & 0xff;
249
buffer[count++] = (word >> 8) & 0xff;
250
}
251
return count;
252
}
253
254
static void tnt4882_release_holdoff(struct gpib_board *board, struct tnt4882_priv *tnt_priv)
255
{
256
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
257
unsigned short sasr_bits;
258
259
sasr_bits = tnt_readb(tnt_priv, SASR);
260
261
/*
262
* tnt4882 not in one-chip mode won't always release holdoff unless we
263
* are in the right mode when release handshake command is given
264
*/
265
if (sasr_bits & AEHS_BIT) /* holding off due to holdoff on end mode*/ {
266
nec7210_set_handshake_mode(board, nec_priv, HR_HLDE);
267
write_byte(nec_priv, AUX_FH, AUXMR);
268
} else if (sasr_bits & ANHS1_BIT) { /* held off due to holdoff on all data mode*/
269
nec7210_set_handshake_mode(board, nec_priv, HR_HLDA);
270
write_byte(nec_priv, AUX_FH, AUXMR);
271
nec7210_set_handshake_mode(board, nec_priv, HR_HLDE);
272
} else { /* held off due to holdoff immediately command */
273
nec7210_set_handshake_mode(board, nec_priv, HR_HLDE);
274
write_byte(nec_priv, AUX_FH, AUXMR);
275
}
276
}
277
278
static int tnt4882_accel_read(struct gpib_board *board, u8 *buffer, size_t length, int *end,
279
size_t *bytes_read)
280
{
281
size_t count = 0;
282
ssize_t retval = 0;
283
struct tnt4882_priv *tnt_priv = board->private_data;
284
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
285
unsigned int bits;
286
s32 hw_count;
287
unsigned long flags;
288
289
*bytes_read = 0;
290
// FIXME: really, DEV_CLEAR_BN should happen elsewhere to prevent race
291
clear_bit(DEV_CLEAR_BN, &nec_priv->state);
292
clear_bit(ADR_CHANGE_BN, &nec_priv->state);
293
294
nec7210_set_reg_bits(nec_priv, IMR1, HR_ENDIE, HR_ENDIE);
295
if (nec_priv->type != TNT4882 && nec_priv->type != TNT5004)
296
nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAI, HR_DMAI);
297
else
298
nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAI, 0);
299
tnt_writeb(tnt_priv, nec_priv->auxa_bits | HR_HLDA, CCR);
300
bits = TNT_B_16BIT | TNT_IN | TNT_CCEN;
301
tnt_writeb(tnt_priv, bits, CFG);
302
tnt_writeb(tnt_priv, RESET_FIFO, CMDR);
303
udelay(1);
304
// load 2's complement of count into hardware counters
305
hw_count = -length;
306
tnt_writeb(tnt_priv, hw_count & 0xff, CNT0);
307
tnt_writeb(tnt_priv, (hw_count >> 8) & 0xff, CNT1);
308
tnt_writeb(tnt_priv, (hw_count >> 16) & 0xff, CNT2);
309
tnt_writeb(tnt_priv, (hw_count >> 24) & 0xff, CNT3);
310
311
tnt4882_release_holdoff(board, tnt_priv);
312
313
tnt_writeb(tnt_priv, GO, CMDR);
314
udelay(1);
315
316
spin_lock_irqsave(&board->spinlock, flags);
317
tnt_priv->imr3_bits |= HR_DONE | HR_NEF;
318
tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
319
spin_unlock_irqrestore(&board->spinlock, flags);
320
321
while (count + 2 <= length &&
322
test_bit(RECEIVED_END_BN, &nec_priv->state) == 0 &&
323
fifo_xfer_done(tnt_priv) == 0) {
324
// wait until a word is ready
325
if (wait_event_interruptible(board->wait,
326
fifo_word_available(tnt_priv) ||
327
fifo_xfer_done(tnt_priv) ||
328
test_bit(RECEIVED_END_BN, &nec_priv->state) ||
329
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
330
test_bit(ADR_CHANGE_BN, &nec_priv->state) ||
331
test_bit(TIMO_NUM, &board->status))) {
332
retval = -ERESTARTSYS;
333
break;
334
}
335
if (test_bit(TIMO_NUM, &board->status)) {
336
retval = -ETIMEDOUT;
337
break;
338
}
339
if (test_bit(DEV_CLEAR_BN, &nec_priv->state)) {
340
retval = -EINTR;
341
break;
342
}
343
if (test_bit(ADR_CHANGE_BN, &nec_priv->state)) {
344
retval = -EINTR;
345
break;
346
}
347
348
spin_lock_irqsave(&board->spinlock, flags);
349
count += drain_fifo_words(tnt_priv, &buffer[count], length - count);
350
tnt_priv->imr3_bits |= HR_NEF;
351
tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
352
spin_unlock_irqrestore(&board->spinlock, flags);
353
354
if (need_resched())
355
schedule();
356
}
357
// wait for last byte
358
if (count < length) {
359
spin_lock_irqsave(&board->spinlock, flags);
360
tnt_priv->imr3_bits |= HR_DONE | HR_NEF;
361
tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
362
spin_unlock_irqrestore(&board->spinlock, flags);
363
364
if (wait_event_interruptible(board->wait,
365
fifo_xfer_done(tnt_priv) ||
366
test_bit(RECEIVED_END_BN, &nec_priv->state) ||
367
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
368
test_bit(ADR_CHANGE_BN, &nec_priv->state) ||
369
test_bit(TIMO_NUM, &board->status))) {
370
retval = -ERESTARTSYS;
371
}
372
if (test_bit(TIMO_NUM, &board->status))
373
retval = -ETIMEDOUT;
374
if (test_bit(DEV_CLEAR_BN, &nec_priv->state))
375
retval = -EINTR;
376
if (test_bit(ADR_CHANGE_BN, &nec_priv->state))
377
retval = -EINTR;
378
count += drain_fifo_words(tnt_priv, &buffer[count], length - count);
379
if (fifo_byte_available(tnt_priv) && count < length)
380
buffer[count++] = tnt_readb(tnt_priv, FIFOB);
381
}
382
if (count < length)
383
tnt_writeb(tnt_priv, STOP, CMDR);
384
udelay(1);
385
386
nec7210_set_reg_bits(nec_priv, IMR1, HR_ENDIE, 0);
387
nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAI, 0);
388
/*
389
* force handling of any pending interrupts (seems to be needed
390
* to keep interrupts from getting hosed, plus for syncing
391
* with RECEIVED_END below)
392
*/
393
tnt4882_internal_interrupt(board);
394
/* RECEIVED_END should be in sync now */
395
if (test_and_clear_bit(RECEIVED_END_BN, &nec_priv->state))
396
*end = 1;
397
if (retval < 0) {
398
// force immediate holdoff
399
write_byte(nec_priv, AUX_HLDI, AUXMR);
400
401
set_bit(RFD_HOLDOFF_BN, &nec_priv->state);
402
}
403
*bytes_read = count;
404
405
return retval;
406
}
407
408
static int fifo_space_available(struct tnt4882_priv *tnt_priv)
409
{
410
int status2;
411
int retval;
412
413
status2 = tnt_readb(tnt_priv, STS2);
414
retval = (status2 & AFFN) && (status2 & BFFN);
415
416
return retval;
417
}
418
419
static unsigned int tnt_transfer_count(struct tnt4882_priv *tnt_priv)
420
{
421
unsigned int count = 0;
422
423
count |= tnt_readb(tnt_priv, CNT0) & 0xff;
424
count |= (tnt_readb(tnt_priv, CNT1) << 8) & 0xff00;
425
count |= (tnt_readb(tnt_priv, CNT2) << 16) & 0xff0000;
426
count |= (tnt_readb(tnt_priv, CNT3) << 24) & 0xff000000;
427
// return two's complement
428
return -count;
429
};
430
431
static int write_wait(struct gpib_board *board, struct tnt4882_priv *tnt_priv,
432
int wait_for_done, int send_commands)
433
{
434
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
435
436
if (wait_event_interruptible(board->wait,
437
(!wait_for_done && fifo_space_available(tnt_priv)) ||
438
fifo_xfer_done(tnt_priv) ||
439
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
440
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
441
test_bit(TIMO_NUM, &board->status)))
442
return -ERESTARTSYS;
443
444
if (test_bit(TIMO_NUM, &board->status))
445
return -ETIMEDOUT;
446
if (test_and_clear_bit(BUS_ERROR_BN, &nec_priv->state))
447
return (send_commands) ? -ENOTCONN : -ECOMM;
448
if (test_bit(DEV_CLEAR_BN, &nec_priv->state))
449
return -EINTR;
450
return 0;
451
}
452
453
static int generic_write(struct gpib_board *board, u8 *buffer, size_t length,
454
int send_eoi, int send_commands, size_t *bytes_written)
455
{
456
size_t count = 0;
457
ssize_t retval = 0;
458
struct tnt4882_priv *tnt_priv = board->private_data;
459
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
460
unsigned int bits;
461
s32 hw_count;
462
unsigned long flags;
463
464
*bytes_written = 0;
465
// FIXME: really, DEV_CLEAR_BN should happen elsewhere to prevent race
466
clear_bit(DEV_CLEAR_BN, &nec_priv->state);
467
468
nec7210_set_reg_bits(nec_priv, IMR1, HR_ERRIE, HR_ERRIE);
469
470
if (nec_priv->type != TNT4882 && nec_priv->type != TNT5004)
471
nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAO, HR_DMAO);
472
else
473
nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAO, 0);
474
475
tnt_writeb(tnt_priv, RESET_FIFO, CMDR);
476
udelay(1);
477
478
bits = TNT_B_16BIT;
479
if (send_eoi) {
480
bits |= TNT_CCEN;
481
if (nec_priv->type != TNT4882 && nec_priv->type != TNT5004)
482
tnt_writeb(tnt_priv, AUX_SEOI, CCR);
483
}
484
if (send_commands)
485
bits |= TNT_COMMAND;
486
tnt_writeb(tnt_priv, bits, CFG);
487
488
// load 2's complement of count into hardware counters
489
hw_count = -length;
490
tnt_writeb(tnt_priv, hw_count & 0xff, CNT0);
491
tnt_writeb(tnt_priv, (hw_count >> 8) & 0xff, CNT1);
492
tnt_writeb(tnt_priv, (hw_count >> 16) & 0xff, CNT2);
493
tnt_writeb(tnt_priv, (hw_count >> 24) & 0xff, CNT3);
494
495
tnt_writeb(tnt_priv, GO, CMDR);
496
udelay(1);
497
498
spin_lock_irqsave(&board->spinlock, flags);
499
tnt_priv->imr3_bits |= HR_DONE;
500
tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
501
spin_unlock_irqrestore(&board->spinlock, flags);
502
503
while (count < length) {
504
// wait until byte is ready to be sent
505
retval = write_wait(board, tnt_priv, 0, send_commands);
506
if (retval < 0)
507
break;
508
if (fifo_xfer_done(tnt_priv))
509
break;
510
spin_lock_irqsave(&board->spinlock, flags);
511
while (fifo_space_available(tnt_priv) && count < length) {
512
u16 word;
513
514
word = buffer[count++] & 0xff;
515
if (count < length)
516
word |= (buffer[count++] << 8) & 0xff00;
517
iowrite16(word, nec_priv->mmiobase + FIFOB);
518
}
519
// avoid unnecessary HR_NFF interrupts
520
// tnt_priv->imr3_bits |= HR_NFF;
521
// tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
522
spin_unlock_irqrestore(&board->spinlock, flags);
523
524
if (need_resched())
525
schedule();
526
}
527
// wait last byte has been sent
528
if (retval == 0)
529
retval = write_wait(board, tnt_priv, 1, send_commands);
530
531
tnt_writeb(tnt_priv, STOP, CMDR);
532
udelay(1);
533
534
nec7210_set_reg_bits(nec_priv, IMR1, HR_ERR, 0x0);
535
nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAO, 0x0);
536
/*
537
* force handling of any interrupts that happened
538
* while they were masked (this appears to be needed)
539
*/
540
tnt4882_internal_interrupt(board);
541
*bytes_written = length - tnt_transfer_count(tnt_priv);
542
return retval;
543
}
544
545
static int tnt4882_accel_write(struct gpib_board *board, u8 *buffer,
546
size_t length, int send_eoi, size_t *bytes_written)
547
{
548
return generic_write(board, buffer, length, send_eoi, 0, bytes_written);
549
}
550
551
static int tnt4882_command(struct gpib_board *board, u8 *buffer, size_t length,
552
size_t *bytes_written)
553
{
554
return generic_write(board, buffer, length, 0, 1, bytes_written);
555
}
556
557
static irqreturn_t tnt4882_internal_interrupt(struct gpib_board *board)
558
{
559
struct tnt4882_priv *priv = board->private_data;
560
int isr0_bits, isr3_bits, imr3_bits;
561
unsigned long flags;
562
563
spin_lock_irqsave(&board->spinlock, flags);
564
565
nec7210_interrupt(board, &priv->nec7210_priv);
566
567
isr0_bits = tnt_readb(priv, ISR0);
568
isr3_bits = tnt_readb(priv, ISR3);
569
imr3_bits = priv->imr3_bits;
570
571
if (isr0_bits & TNT_IFCI_BIT)
572
push_gpib_event(board, EVENT_IFC);
573
// XXX don't need this wakeup, one below should do?
574
// wake_up_interruptible(&board->wait);
575
576
if (isr3_bits & HR_NFF)
577
priv->imr3_bits &= ~HR_NFF;
578
if (isr3_bits & HR_NEF)
579
priv->imr3_bits &= ~HR_NEF;
580
if (isr3_bits & HR_DONE)
581
priv->imr3_bits &= ~HR_DONE;
582
if (isr3_bits & (HR_INTR | HR_TLCI)) {
583
dev_dbg(board->gpib_dev, "minor %i isr0 0x%x imr0 0x%x isr3 0x%x imr3 0x%x\n",
584
board->minor, isr0_bits, priv->imr0_bits, isr3_bits, imr3_bits);
585
tnt_writeb(priv, priv->imr3_bits, IMR3);
586
wake_up_interruptible(&board->wait);
587
}
588
spin_unlock_irqrestore(&board->spinlock, flags);
589
return IRQ_HANDLED;
590
}
591
592
static irqreturn_t tnt4882_interrupt(int irq, void *arg)
593
{
594
return tnt4882_internal_interrupt(arg);
595
}
596
597
// wrappers for interface functions
598
static int tnt4882_read(struct gpib_board *board, u8 *buffer, size_t length, int *end,
599
size_t *bytes_read)
600
{
601
struct tnt4882_priv *priv = board->private_data;
602
struct nec7210_priv *nec_priv = &priv->nec7210_priv;
603
int retval;
604
int dummy;
605
606
retval = nec7210_read(board, &priv->nec7210_priv, buffer, length, end, bytes_read);
607
608
if (retval < 0) { // force immediate holdoff
609
write_byte(nec_priv, AUX_HLDI, AUXMR);
610
611
set_bit(RFD_HOLDOFF_BN, &nec_priv->state);
612
613
nec7210_read_data_in(board, nec_priv, &dummy);
614
}
615
return retval;
616
}
617
618
static int tnt4882_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi,
619
size_t *bytes_written)
620
{
621
struct tnt4882_priv *priv = board->private_data;
622
623
return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written);
624
}
625
626
static int tnt4882_command_unaccel(struct gpib_board *board, u8 *buffer,
627
size_t length, size_t *bytes_written)
628
{
629
struct tnt4882_priv *priv = board->private_data;
630
631
return nec7210_command(board, &priv->nec7210_priv, buffer, length, bytes_written);
632
}
633
634
static int tnt4882_take_control(struct gpib_board *board, int synchronous)
635
{
636
struct tnt4882_priv *priv = board->private_data;
637
638
return nec7210_take_control(board, &priv->nec7210_priv, synchronous);
639
}
640
641
static int tnt4882_go_to_standby(struct gpib_board *board)
642
{
643
struct tnt4882_priv *priv = board->private_data;
644
645
return nec7210_go_to_standby(board, &priv->nec7210_priv);
646
}
647
648
static int tnt4882_request_system_control(struct gpib_board *board, int request_control)
649
{
650
struct tnt4882_priv *priv = board->private_data;
651
int retval;
652
653
if (request_control) {
654
tnt_writeb(priv, SETSC, CMDR);
655
udelay(1);
656
}
657
retval = nec7210_request_system_control(board, &priv->nec7210_priv, request_control);
658
if (!request_control) {
659
tnt_writeb(priv, CLRSC, CMDR);
660
udelay(1);
661
}
662
return retval;
663
}
664
665
static void tnt4882_interface_clear(struct gpib_board *board, int assert)
666
{
667
struct tnt4882_priv *priv = board->private_data;
668
669
nec7210_interface_clear(board, &priv->nec7210_priv, assert);
670
}
671
672
static void tnt4882_remote_enable(struct gpib_board *board, int enable)
673
{
674
struct tnt4882_priv *priv = board->private_data;
675
676
nec7210_remote_enable(board, &priv->nec7210_priv, enable);
677
}
678
679
static int tnt4882_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits)
680
{
681
struct tnt4882_priv *priv = board->private_data;
682
683
return nec7210_enable_eos(board, &priv->nec7210_priv, eos_byte, compare_8_bits);
684
}
685
686
static void tnt4882_disable_eos(struct gpib_board *board)
687
{
688
struct tnt4882_priv *priv = board->private_data;
689
690
nec7210_disable_eos(board, &priv->nec7210_priv);
691
}
692
693
static unsigned int tnt4882_update_status(struct gpib_board *board, unsigned int clear_mask)
694
{
695
unsigned long flags;
696
u8 line_status;
697
struct tnt4882_priv *priv = board->private_data;
698
699
spin_lock_irqsave(&board->spinlock, flags);
700
board->status &= ~clear_mask;
701
nec7210_update_status_nolock(board, &priv->nec7210_priv);
702
/* set / clear SRQ state since it is not cleared by interrupt */
703
line_status = tnt_readb(priv, BSR);
704
if (line_status & BCSR_SRQ_BIT)
705
set_bit(SRQI_NUM, &board->status);
706
else
707
clear_bit(SRQI_NUM, &board->status);
708
spin_unlock_irqrestore(&board->spinlock, flags);
709
return board->status;
710
}
711
712
static int tnt4882_primary_address(struct gpib_board *board, unsigned int address)
713
{
714
struct tnt4882_priv *priv = board->private_data;
715
716
return nec7210_primary_address(board, &priv->nec7210_priv, address);
717
}
718
719
static int tnt4882_secondary_address(struct gpib_board *board, unsigned int address, int enable)
720
{
721
struct tnt4882_priv *priv = board->private_data;
722
723
return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable);
724
}
725
726
static int tnt4882_parallel_poll(struct gpib_board *board, u8 *result)
727
{
728
struct tnt4882_priv *tnt_priv = board->private_data;
729
730
if (tnt_priv->nec7210_priv.type != NEC7210) {
731
tnt_priv->auxg_bits |= RPP2_BIT;
732
write_byte(&tnt_priv->nec7210_priv, tnt_priv->auxg_bits, AUXMR);
733
udelay(2); // FIXME use parallel poll timeout
734
*result = read_byte(&tnt_priv->nec7210_priv, CPTR);
735
tnt_priv->auxg_bits &= ~RPP2_BIT;
736
write_byte(&tnt_priv->nec7210_priv, tnt_priv->auxg_bits, AUXMR);
737
return 0;
738
} else {
739
return nec7210_parallel_poll(board, &tnt_priv->nec7210_priv, result);
740
}
741
}
742
743
static void tnt4882_parallel_poll_configure(struct gpib_board *board, u8 config)
744
{
745
struct tnt4882_priv *priv = board->private_data;
746
747
if (priv->nec7210_priv.type == TNT5004) {
748
/* configure locally */
749
write_byte(&priv->nec7210_priv, AUXRI | 0x4, AUXMR);
750
if (config)
751
/* set response + clear sense */
752
write_byte(&priv->nec7210_priv, PPR | config, AUXMR);
753
else
754
/* disable ppoll */
755
write_byte(&priv->nec7210_priv, PPR | 0x10, AUXMR);
756
} else {
757
nec7210_parallel_poll_configure(board, &priv->nec7210_priv, config);
758
}
759
}
760
761
static void tnt4882_parallel_poll_response(struct gpib_board *board, int ist)
762
{
763
struct tnt4882_priv *priv = board->private_data;
764
765
nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist);
766
}
767
768
/*
769
* this is just used by the old nec7210 isa interfaces, the newer
770
* boards use tnt4882_serial_poll_response2
771
*/
772
static void tnt4882_serial_poll_response(struct gpib_board *board, u8 status)
773
{
774
struct tnt4882_priv *priv = board->private_data;
775
776
nec7210_serial_poll_response(board, &priv->nec7210_priv, status);
777
}
778
779
static void tnt4882_serial_poll_response2(struct gpib_board *board, u8 status,
780
int new_reason_for_service)
781
{
782
struct tnt4882_priv *priv = board->private_data;
783
unsigned long flags;
784
const int MSS = status & request_service_bit;
785
const int reqt = MSS && new_reason_for_service;
786
const int reqf = MSS == 0;
787
788
spin_lock_irqsave(&board->spinlock, flags);
789
if (reqt) {
790
priv->nec7210_priv.srq_pending = 1;
791
clear_bit(SPOLL_NUM, &board->status);
792
} else {
793
if (reqf)
794
priv->nec7210_priv.srq_pending = 0;
795
}
796
if (reqt)
797
/*
798
* It may seem like a race to issue reqt before updating
799
* the status byte, but it is not. The chip does not
800
* issue the reqt until the SPMR is written to at
801
* a later time.
802
*/
803
write_byte(&priv->nec7210_priv, AUX_REQT, AUXMR);
804
else if (reqf)
805
write_byte(&priv->nec7210_priv, AUX_REQF, AUXMR);
806
/*
807
* We need to always zero bit 6 of the status byte before writing it to
808
* the SPMR to insure we are using
809
* serial poll mode SP1, and not accidentally triggering mode SP3.
810
*/
811
write_byte(&priv->nec7210_priv, status & ~request_service_bit, SPMR);
812
spin_unlock_irqrestore(&board->spinlock, flags);
813
}
814
815
static u8 tnt4882_serial_poll_status(struct gpib_board *board)
816
{
817
struct tnt4882_priv *priv = board->private_data;
818
819
return nec7210_serial_poll_status(board, &priv->nec7210_priv);
820
}
821
822
static void tnt4882_return_to_local(struct gpib_board *board)
823
{
824
struct tnt4882_priv *priv = board->private_data;
825
826
nec7210_return_to_local(board, &priv->nec7210_priv);
827
}
828
829
static void tnt4882_board_reset(struct tnt4882_priv *tnt_priv, struct gpib_board *board)
830
{
831
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
832
833
tnt_priv->imr0_bits = 0;
834
tnt_writeb(tnt_priv, tnt_priv->imr0_bits, IMR0);
835
tnt_priv->imr3_bits = 0;
836
tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
837
tnt_readb(tnt_priv, IMR0);
838
tnt_readb(tnt_priv, IMR3);
839
nec7210_board_reset(nec_priv, board);
840
}
841
842
static int tnt4882_allocate_private(struct gpib_board *board)
843
{
844
struct tnt4882_priv *tnt_priv;
845
846
board->private_data = kmalloc(sizeof(struct tnt4882_priv), GFP_KERNEL);
847
if (!board->private_data)
848
return -1;
849
tnt_priv = board->private_data;
850
memset(tnt_priv, 0, sizeof(struct tnt4882_priv));
851
init_nec7210_private(&tnt_priv->nec7210_priv);
852
return 0;
853
}
854
855
static void tnt4882_free_private(struct gpib_board *board)
856
{
857
kfree(board->private_data);
858
board->private_data = NULL;
859
}
860
861
static void tnt4882_init(struct tnt4882_priv *tnt_priv, const struct gpib_board *board)
862
{
863
struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv;
864
865
/* Turbo488 software reset */
866
tnt_writeb(tnt_priv, SOFT_RESET, CMDR);
867
udelay(1);
868
869
// turn off one-chip mode
870
tnt_writeb(tnt_priv, NODMA, HSSEL);
871
tnt_writeb(tnt_priv, 0, ACCWR);
872
// make sure we are in 7210 mode
873
tnt_writeb(tnt_priv, AUX_7210, AUXCR);
874
udelay(1);
875
// registers might be swapped, so write it to the swapped address too
876
tnt_writeb(tnt_priv, AUX_7210, SWAPPED_AUXCR);
877
udelay(1);
878
// turn on one-chip mode
879
if (nec_priv->type == TNT4882 || nec_priv->type == TNT5004)
880
tnt_writeb(tnt_priv, NODMA | TNT_ONE_CHIP_BIT, HSSEL);
881
else
882
tnt_writeb(tnt_priv, NODMA, HSSEL);
883
884
nec7210_board_reset(nec_priv, board);
885
// read-clear isr0
886
tnt_readb(tnt_priv, ISR0);
887
888
// enable passing of nat4882 interrupts
889
tnt_priv->imr3_bits = HR_TLCI;
890
tnt_writeb(tnt_priv, tnt_priv->imr3_bits, IMR3);
891
892
// enable interrupt
893
tnt_writeb(tnt_priv, 0x1, INTRT);
894
895
// force immediate holdoff
896
write_byte(&tnt_priv->nec7210_priv, AUX_HLDI, AUXMR);
897
898
set_bit(RFD_HOLDOFF_BN, &nec_priv->state);
899
900
tnt_priv->auxg_bits = AUXRG | NTNL_BIT;
901
write_byte(&tnt_priv->nec7210_priv, tnt_priv->auxg_bits, AUXMR);
902
903
nec7210_board_online(nec_priv, board);
904
// enable interface clear interrupt for event queue
905
tnt_priv->imr0_bits = TNT_IMR0_ALWAYS_BITS | TNT_ATNI_BIT | TNT_IFCIE_BIT;
906
tnt_writeb(tnt_priv, tnt_priv->imr0_bits, IMR0);
907
}
908
909
static int ni_pci_attach(struct gpib_board *board, const struct gpib_board_config *config)
910
{
911
struct tnt4882_priv *tnt_priv;
912
struct nec7210_priv *nec_priv;
913
int isr_flags = IRQF_SHARED;
914
int retval;
915
struct mite_struct *mite;
916
917
board->status = 0;
918
919
if (tnt4882_allocate_private(board))
920
return -ENOMEM;
921
tnt_priv = board->private_data;
922
nec_priv = &tnt_priv->nec7210_priv;
923
nec_priv->type = TNT4882;
924
nec_priv->read_byte = nec7210_locking_iomem_read_byte;
925
nec_priv->write_byte = nec7210_locking_iomem_write_byte;
926
nec_priv->offset = atgpib_reg_offset;
927
928
if (!mite_devices)
929
return -ENODEV;
930
931
for (mite = mite_devices; mite; mite = mite->next) {
932
short found_board;
933
934
if (mite->used)
935
continue;
936
if (config->pci_bus >= 0 && config->pci_bus != mite->pcidev->bus->number)
937
continue;
938
if (config->pci_slot >= 0 && config->pci_slot != PCI_SLOT(mite->pcidev->devfn))
939
continue;
940
switch (mite_device_id(mite)) {
941
case PCI_DEVICE_ID_NI_GPIB:
942
case PCI_DEVICE_ID_NI_GPIB_PLUS:
943
case PCI_DEVICE_ID_NI_GPIB_PLUS2:
944
case PCI_DEVICE_ID_NI_PXIGPIB:
945
case PCI_DEVICE_ID_NI_PMCGPIB:
946
case PCI_DEVICE_ID_NI_PCIEGPIB:
947
case PCI_DEVICE_ID_NI_PCIE2GPIB:
948
// support for Measurement Computing PCI-488
949
case PCI_DEVICE_ID_MC_PCI488:
950
case PCI_DEVICE_ID_CEC_NI_GPIB:
951
found_board = 1;
952
break;
953
default:
954
found_board = 0;
955
break;
956
}
957
if (found_board)
958
break;
959
}
960
if (!mite)
961
return -ENODEV;
962
963
tnt_priv->mite = mite;
964
retval = mite_setup(tnt_priv->mite);
965
if (retval < 0)
966
return retval;
967
968
nec_priv->mmiobase = tnt_priv->mite->daq_io_addr;
969
970
// get irq
971
retval = request_irq(mite_irq(tnt_priv->mite), tnt4882_interrupt, isr_flags, "ni-pci-gpib",
972
board);
973
if (retval) {
974
dev_err(board->gpib_dev, "failed to obtain pci irq %d\n", mite_irq(tnt_priv->mite));
975
return retval;
976
}
977
tnt_priv->irq = mite_irq(tnt_priv->mite);
978
979
// TNT5004 detection
980
switch (tnt_readb(tnt_priv, CSR) & 0xf0) {
981
case 0x30:
982
nec_priv->type = TNT4882;
983
break;
984
case 0x40:
985
nec_priv->type = TNT5004;
986
break;
987
}
988
tnt4882_init(tnt_priv, board);
989
990
return 0;
991
}
992
993
static void ni_pci_detach(struct gpib_board *board)
994
{
995
struct tnt4882_priv *tnt_priv = board->private_data;
996
struct nec7210_priv *nec_priv;
997
998
if (tnt_priv) {
999
nec_priv = &tnt_priv->nec7210_priv;
1000
1001
if (nec_priv->mmiobase)
1002
tnt4882_board_reset(tnt_priv, board);
1003
if (tnt_priv->irq)
1004
free_irq(tnt_priv->irq, board);
1005
if (tnt_priv->mite)
1006
mite_unsetup(tnt_priv->mite);
1007
}
1008
tnt4882_free_private(board);
1009
}
1010
1011
static int ni_isapnp_find(struct pnp_dev **dev)
1012
{
1013
*dev = pnp_find_dev(NULL, ISAPNP_VENDOR_ID_NI,
1014
ISAPNP_FUNCTION(ISAPNP_ID_NI_ATGPIB_TNT), NULL);
1015
if (!*dev || !(*dev)->card)
1016
return -ENODEV;
1017
if (pnp_device_attach(*dev) < 0)
1018
return -EBUSY;
1019
if (pnp_activate_dev(*dev) < 0) {
1020
pnp_device_detach(*dev);
1021
return -EAGAIN;
1022
}
1023
if (!pnp_port_valid(*dev, 0) || !pnp_irq_valid(*dev, 0)) {
1024
pnp_device_detach(*dev);
1025
return -EINVAL;
1026
}
1027
return 0;
1028
}
1029
1030
static int ni_isa_attach_common(struct gpib_board *board, const struct gpib_board_config *config,
1031
enum nec7210_chipset chipset)
1032
{
1033
struct tnt4882_priv *tnt_priv;
1034
struct nec7210_priv *nec_priv;
1035
int isr_flags = 0;
1036
u32 iobase;
1037
int irq;
1038
int retval;
1039
1040
board->status = 0;
1041
1042
if (tnt4882_allocate_private(board))
1043
return -ENOMEM;
1044
tnt_priv = board->private_data;
1045
nec_priv = &tnt_priv->nec7210_priv;
1046
nec_priv->type = chipset;
1047
nec_priv->read_byte = nec7210_locking_ioport_read_byte;
1048
nec_priv->write_byte = nec7210_locking_ioport_write_byte;
1049
nec_priv->offset = atgpib_reg_offset;
1050
1051
// look for plug-n-play board
1052
if (config->ibbase == 0) {
1053
struct pnp_dev *dev;
1054
1055
retval = ni_isapnp_find(&dev);
1056
if (retval < 0)
1057
return retval;
1058
tnt_priv->pnp_dev = dev;
1059
iobase = pnp_port_start(dev, 0);
1060
irq = pnp_irq(dev, 0);
1061
} else {
1062
iobase = config->ibbase;
1063
irq = config->ibirq;
1064
}
1065
// allocate ioports
1066
if (!request_region(iobase, atgpib_iosize, "atgpib"))
1067
return -EBUSY;
1068
1069
nec_priv->mmiobase = ioport_map(iobase, atgpib_iosize);
1070
if (!nec_priv->mmiobase)
1071
return -EBUSY;
1072
1073
// get irq
1074
retval = request_irq(irq, tnt4882_interrupt, isr_flags, "atgpib", board);
1075
if (retval) {
1076
dev_err(board->gpib_dev, "failed to request ISA irq %d\n", irq);
1077
return retval;
1078
}
1079
tnt_priv->irq = irq;
1080
1081
tnt4882_init(tnt_priv, board);
1082
1083
return 0;
1084
}
1085
1086
static int ni_tnt_isa_attach(struct gpib_board *board, const struct gpib_board_config *config)
1087
{
1088
return ni_isa_attach_common(board, config, TNT4882);
1089
}
1090
1091
static int ni_nat4882_isa_attach(struct gpib_board *board, const struct gpib_board_config *config)
1092
{
1093
return ni_isa_attach_common(board, config, NAT4882);
1094
}
1095
1096
static int ni_nec_isa_attach(struct gpib_board *board, const struct gpib_board_config *config)
1097
{
1098
return ni_isa_attach_common(board, config, NEC7210);
1099
}
1100
1101
static void ni_isa_detach(struct gpib_board *board)
1102
{
1103
struct tnt4882_priv *tnt_priv = board->private_data;
1104
struct nec7210_priv *nec_priv;
1105
1106
if (tnt_priv) {
1107
nec_priv = &tnt_priv->nec7210_priv;
1108
if (nec_priv->iobase)
1109
tnt4882_board_reset(tnt_priv, board);
1110
if (tnt_priv->irq)
1111
free_irq(tnt_priv->irq, board);
1112
if (nec_priv->mmiobase)
1113
ioport_unmap(nec_priv->mmiobase);
1114
if (nec_priv->iobase)
1115
release_region(nec_priv->iobase, atgpib_iosize);
1116
if (tnt_priv->pnp_dev)
1117
pnp_device_detach(tnt_priv->pnp_dev);
1118
}
1119
tnt4882_free_private(board);
1120
}
1121
1122
static int tnt4882_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1123
{
1124
return 0;
1125
}
1126
1127
static struct gpib_interface ni_pci_interface = {
1128
.name = "ni_pci",
1129
.attach = ni_pci_attach,
1130
.detach = ni_pci_detach,
1131
.read = tnt4882_accel_read,
1132
.write = tnt4882_accel_write,
1133
.command = tnt4882_command,
1134
.take_control = tnt4882_take_control,
1135
.go_to_standby = tnt4882_go_to_standby,
1136
.request_system_control = tnt4882_request_system_control,
1137
.interface_clear = tnt4882_interface_clear,
1138
.remote_enable = tnt4882_remote_enable,
1139
.enable_eos = tnt4882_enable_eos,
1140
.disable_eos = tnt4882_disable_eos,
1141
.parallel_poll = tnt4882_parallel_poll,
1142
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1143
.parallel_poll_response = tnt4882_parallel_poll_response,
1144
.local_parallel_poll_mode = NULL, // XXX
1145
.line_status = tnt4882_line_status,
1146
.update_status = tnt4882_update_status,
1147
.primary_address = tnt4882_primary_address,
1148
.secondary_address = tnt4882_secondary_address,
1149
.serial_poll_response2 = tnt4882_serial_poll_response2,
1150
.serial_poll_status = tnt4882_serial_poll_status,
1151
.t1_delay = tnt4882_t1_delay,
1152
.return_to_local = tnt4882_return_to_local,
1153
};
1154
1155
static struct gpib_interface ni_pci_accel_interface = {
1156
.name = "ni_pci_accel",
1157
.attach = ni_pci_attach,
1158
.detach = ni_pci_detach,
1159
.read = tnt4882_accel_read,
1160
.write = tnt4882_accel_write,
1161
.command = tnt4882_command,
1162
.take_control = tnt4882_take_control,
1163
.go_to_standby = tnt4882_go_to_standby,
1164
.request_system_control = tnt4882_request_system_control,
1165
.interface_clear = tnt4882_interface_clear,
1166
.remote_enable = tnt4882_remote_enable,
1167
.enable_eos = tnt4882_enable_eos,
1168
.disable_eos = tnt4882_disable_eos,
1169
.parallel_poll = tnt4882_parallel_poll,
1170
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1171
.parallel_poll_response = tnt4882_parallel_poll_response,
1172
.local_parallel_poll_mode = NULL, // XXX
1173
.line_status = tnt4882_line_status,
1174
.update_status = tnt4882_update_status,
1175
.primary_address = tnt4882_primary_address,
1176
.secondary_address = tnt4882_secondary_address,
1177
.serial_poll_response2 = tnt4882_serial_poll_response2,
1178
.serial_poll_status = tnt4882_serial_poll_status,
1179
.t1_delay = tnt4882_t1_delay,
1180
.return_to_local = tnt4882_return_to_local,
1181
};
1182
1183
static struct gpib_interface ni_isa_interface = {
1184
.name = "ni_isa",
1185
.attach = ni_tnt_isa_attach,
1186
.detach = ni_isa_detach,
1187
.read = tnt4882_accel_read,
1188
.write = tnt4882_accel_write,
1189
.command = tnt4882_command,
1190
.take_control = tnt4882_take_control,
1191
.go_to_standby = tnt4882_go_to_standby,
1192
.request_system_control = tnt4882_request_system_control,
1193
.interface_clear = tnt4882_interface_clear,
1194
.remote_enable = tnt4882_remote_enable,
1195
.enable_eos = tnt4882_enable_eos,
1196
.disable_eos = tnt4882_disable_eos,
1197
.parallel_poll = tnt4882_parallel_poll,
1198
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1199
.parallel_poll_response = tnt4882_parallel_poll_response,
1200
.local_parallel_poll_mode = NULL, // XXX
1201
.line_status = tnt4882_line_status,
1202
.update_status = tnt4882_update_status,
1203
.primary_address = tnt4882_primary_address,
1204
.secondary_address = tnt4882_secondary_address,
1205
.serial_poll_response2 = tnt4882_serial_poll_response2,
1206
.serial_poll_status = tnt4882_serial_poll_status,
1207
.t1_delay = tnt4882_t1_delay,
1208
.return_to_local = tnt4882_return_to_local,
1209
};
1210
1211
static struct gpib_interface ni_nat4882_isa_interface = {
1212
.name = "ni_nat4882_isa",
1213
.attach = ni_nat4882_isa_attach,
1214
.detach = ni_isa_detach,
1215
.read = tnt4882_read,
1216
.write = tnt4882_write,
1217
.command = tnt4882_command_unaccel,
1218
.take_control = tnt4882_take_control,
1219
.go_to_standby = tnt4882_go_to_standby,
1220
.request_system_control = tnt4882_request_system_control,
1221
.interface_clear = tnt4882_interface_clear,
1222
.remote_enable = tnt4882_remote_enable,
1223
.enable_eos = tnt4882_enable_eos,
1224
.disable_eos = tnt4882_disable_eos,
1225
.parallel_poll = tnt4882_parallel_poll,
1226
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1227
.parallel_poll_response = tnt4882_parallel_poll_response,
1228
.local_parallel_poll_mode = NULL, // XXX
1229
.line_status = tnt4882_line_status,
1230
.update_status = tnt4882_update_status,
1231
.primary_address = tnt4882_primary_address,
1232
.secondary_address = tnt4882_secondary_address,
1233
.serial_poll_response2 = tnt4882_serial_poll_response2,
1234
.serial_poll_status = tnt4882_serial_poll_status,
1235
.t1_delay = tnt4882_t1_delay,
1236
.return_to_local = tnt4882_return_to_local,
1237
};
1238
1239
static struct gpib_interface ni_nec_isa_interface = {
1240
.name = "ni_nec_isa",
1241
.attach = ni_nec_isa_attach,
1242
.detach = ni_isa_detach,
1243
.read = tnt4882_read,
1244
.write = tnt4882_write,
1245
.command = tnt4882_command_unaccel,
1246
.take_control = tnt4882_take_control,
1247
.go_to_standby = tnt4882_go_to_standby,
1248
.request_system_control = tnt4882_request_system_control,
1249
.interface_clear = tnt4882_interface_clear,
1250
.remote_enable = tnt4882_remote_enable,
1251
.enable_eos = tnt4882_enable_eos,
1252
.disable_eos = tnt4882_disable_eos,
1253
.parallel_poll = tnt4882_parallel_poll,
1254
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1255
.parallel_poll_response = tnt4882_parallel_poll_response,
1256
.local_parallel_poll_mode = NULL, // XXX
1257
.line_status = NULL,
1258
.update_status = tnt4882_update_status,
1259
.primary_address = tnt4882_primary_address,
1260
.secondary_address = tnt4882_secondary_address,
1261
.serial_poll_response = tnt4882_serial_poll_response,
1262
.serial_poll_status = tnt4882_serial_poll_status,
1263
.t1_delay = tnt4882_t1_delay,
1264
.return_to_local = tnt4882_return_to_local,
1265
};
1266
1267
static struct gpib_interface ni_isa_accel_interface = {
1268
.name = "ni_isa_accel",
1269
.attach = ni_tnt_isa_attach,
1270
.detach = ni_isa_detach,
1271
.read = tnt4882_accel_read,
1272
.write = tnt4882_accel_write,
1273
.command = tnt4882_command,
1274
.take_control = tnt4882_take_control,
1275
.go_to_standby = tnt4882_go_to_standby,
1276
.request_system_control = tnt4882_request_system_control,
1277
.interface_clear = tnt4882_interface_clear,
1278
.remote_enable = tnt4882_remote_enable,
1279
.enable_eos = tnt4882_enable_eos,
1280
.disable_eos = tnt4882_disable_eos,
1281
.parallel_poll = tnt4882_parallel_poll,
1282
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1283
.parallel_poll_response = tnt4882_parallel_poll_response,
1284
.local_parallel_poll_mode = NULL, // XXX
1285
.line_status = tnt4882_line_status,
1286
.update_status = tnt4882_update_status,
1287
.primary_address = tnt4882_primary_address,
1288
.secondary_address = tnt4882_secondary_address,
1289
.serial_poll_response2 = tnt4882_serial_poll_response2,
1290
.serial_poll_status = tnt4882_serial_poll_status,
1291
.t1_delay = tnt4882_t1_delay,
1292
.return_to_local = tnt4882_return_to_local,
1293
};
1294
1295
static struct gpib_interface ni_nat4882_isa_accel_interface = {
1296
.name = "ni_nat4882_isa_accel",
1297
.attach = ni_nat4882_isa_attach,
1298
.detach = ni_isa_detach,
1299
.read = tnt4882_accel_read,
1300
.write = tnt4882_accel_write,
1301
.command = tnt4882_command_unaccel,
1302
.take_control = tnt4882_take_control,
1303
.go_to_standby = tnt4882_go_to_standby,
1304
.request_system_control = tnt4882_request_system_control,
1305
.interface_clear = tnt4882_interface_clear,
1306
.remote_enable = tnt4882_remote_enable,
1307
.enable_eos = tnt4882_enable_eos,
1308
.disable_eos = tnt4882_disable_eos,
1309
.parallel_poll = tnt4882_parallel_poll,
1310
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1311
.parallel_poll_response = tnt4882_parallel_poll_response,
1312
.local_parallel_poll_mode = NULL, // XXX
1313
.line_status = tnt4882_line_status,
1314
.update_status = tnt4882_update_status,
1315
.primary_address = tnt4882_primary_address,
1316
.secondary_address = tnt4882_secondary_address,
1317
.serial_poll_response2 = tnt4882_serial_poll_response2,
1318
.serial_poll_status = tnt4882_serial_poll_status,
1319
.t1_delay = tnt4882_t1_delay,
1320
.return_to_local = tnt4882_return_to_local,
1321
};
1322
1323
static struct gpib_interface ni_nec_isa_accel_interface = {
1324
.name = "ni_nec_isa_accel",
1325
.attach = ni_nec_isa_attach,
1326
.detach = ni_isa_detach,
1327
.read = tnt4882_accel_read,
1328
.write = tnt4882_accel_write,
1329
.command = tnt4882_command_unaccel,
1330
.take_control = tnt4882_take_control,
1331
.go_to_standby = tnt4882_go_to_standby,
1332
.request_system_control = tnt4882_request_system_control,
1333
.interface_clear = tnt4882_interface_clear,
1334
.remote_enable = tnt4882_remote_enable,
1335
.enable_eos = tnt4882_enable_eos,
1336
.disable_eos = tnt4882_disable_eos,
1337
.parallel_poll = tnt4882_parallel_poll,
1338
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1339
.parallel_poll_response = tnt4882_parallel_poll_response,
1340
.local_parallel_poll_mode = NULL, // XXX
1341
.line_status = NULL,
1342
.update_status = tnt4882_update_status,
1343
.primary_address = tnt4882_primary_address,
1344
.secondary_address = tnt4882_secondary_address,
1345
.serial_poll_response = tnt4882_serial_poll_response,
1346
.serial_poll_status = tnt4882_serial_poll_status,
1347
.t1_delay = tnt4882_t1_delay,
1348
.return_to_local = tnt4882_return_to_local,
1349
};
1350
1351
static const struct pci_device_id tnt4882_pci_table[] = {
1352
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_GPIB)},
1353
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_GPIB_PLUS)},
1354
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_GPIB_PLUS2)},
1355
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PXIGPIB)},
1356
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PMCGPIB)},
1357
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIEGPIB)},
1358
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIE2GPIB)},
1359
// support for Measurement Computing PCI-488
1360
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_MC_PCI488)},
1361
{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_CEC_NI_GPIB)},
1362
{ 0 }
1363
};
1364
MODULE_DEVICE_TABLE(pci, tnt4882_pci_table);
1365
1366
static struct pci_driver tnt4882_pci_driver = {
1367
.name = DRV_NAME,
1368
.id_table = tnt4882_pci_table,
1369
.probe = &tnt4882_pci_probe
1370
};
1371
1372
#if 0
1373
/* unused, will be needed when the driver is turned into a pnp_driver */
1374
static const struct pnp_device_id tnt4882_pnp_table[] = {
1375
{.id = "NICC601"},
1376
{.id = ""}
1377
};
1378
MODULE_DEVICE_TABLE(pnp, tnt4882_pnp_table);
1379
#endif
1380
1381
#ifdef CONFIG_GPIB_PCMCIA
1382
static struct gpib_interface ni_pcmcia_interface;
1383
static struct gpib_interface ni_pcmcia_accel_interface;
1384
static int __init init_ni_gpib_cs(void);
1385
static void __exit exit_ni_gpib_cs(void);
1386
#endif
1387
1388
static int __init tnt4882_init_module(void)
1389
{
1390
int result;
1391
1392
result = pci_register_driver(&tnt4882_pci_driver);
1393
if (result) {
1394
pr_err("pci_register_driver failed: error = %d\n", result);
1395
return result;
1396
}
1397
1398
result = gpib_register_driver(&ni_isa_interface, THIS_MODULE);
1399
if (result) {
1400
pr_err("gpib_register_driver failed: error = %d\n", result);
1401
goto err_isa;
1402
}
1403
1404
result = gpib_register_driver(&ni_isa_accel_interface, THIS_MODULE);
1405
if (result) {
1406
pr_err("gpib_register_driver failed: error = %d\n", result);
1407
goto err_isa_accel;
1408
}
1409
1410
result = gpib_register_driver(&ni_nat4882_isa_interface, THIS_MODULE);
1411
if (result) {
1412
pr_err("gpib_register_driver failed: error = %d\n", result);
1413
goto err_nat4882_isa;
1414
}
1415
1416
result = gpib_register_driver(&ni_nat4882_isa_accel_interface, THIS_MODULE);
1417
if (result) {
1418
pr_err("gpib_register_driver failed: error = %d\n", result);
1419
goto err_nat4882_isa_accel;
1420
}
1421
1422
result = gpib_register_driver(&ni_nec_isa_interface, THIS_MODULE);
1423
if (result) {
1424
pr_err("gpib_register_driver failed: error = %d\n", result);
1425
goto err_nec_isa;
1426
}
1427
1428
result = gpib_register_driver(&ni_nec_isa_accel_interface, THIS_MODULE);
1429
if (result) {
1430
pr_err("gpib_register_driver failed: error = %d\n", result);
1431
goto err_nec_isa_accel;
1432
}
1433
1434
result = gpib_register_driver(&ni_pci_interface, THIS_MODULE);
1435
if (result) {
1436
pr_err("gpib_register_driver failed: error = %d\n", result);
1437
goto err_pci;
1438
}
1439
1440
result = gpib_register_driver(&ni_pci_accel_interface, THIS_MODULE);
1441
if (result) {
1442
pr_err("gpib_register_driver failed: error = %d\n", result);
1443
goto err_pci_accel;
1444
}
1445
1446
#ifdef CONFIG_GPIB_PCMCIA
1447
result = gpib_register_driver(&ni_pcmcia_interface, THIS_MODULE);
1448
if (result) {
1449
pr_err("gpib_register_driver failed: error = %d\n", result);
1450
goto err_pcmcia;
1451
}
1452
1453
result = gpib_register_driver(&ni_pcmcia_accel_interface, THIS_MODULE);
1454
if (result) {
1455
pr_err("gpib_register_driver failed: error = %d\n", result);
1456
goto err_pcmcia_accel;
1457
}
1458
1459
result = init_ni_gpib_cs();
1460
if (result) {
1461
pr_err("pcmcia_register_driver failed: error = %d\n", result);
1462
goto err_pcmcia_driver;
1463
}
1464
#endif
1465
1466
mite_init();
1467
1468
return 0;
1469
1470
#ifdef CONFIG_GPIB_PCMCIA
1471
err_pcmcia_driver:
1472
gpib_unregister_driver(&ni_pcmcia_accel_interface);
1473
err_pcmcia_accel:
1474
gpib_unregister_driver(&ni_pcmcia_interface);
1475
err_pcmcia:
1476
#endif
1477
gpib_unregister_driver(&ni_pci_accel_interface);
1478
err_pci_accel:
1479
gpib_unregister_driver(&ni_pci_interface);
1480
err_pci:
1481
gpib_unregister_driver(&ni_nec_isa_accel_interface);
1482
err_nec_isa_accel:
1483
gpib_unregister_driver(&ni_nec_isa_interface);
1484
err_nec_isa:
1485
gpib_unregister_driver(&ni_nat4882_isa_accel_interface);
1486
err_nat4882_isa_accel:
1487
gpib_unregister_driver(&ni_nat4882_isa_interface);
1488
err_nat4882_isa:
1489
gpib_unregister_driver(&ni_isa_accel_interface);
1490
err_isa_accel:
1491
gpib_unregister_driver(&ni_isa_interface);
1492
err_isa:
1493
pci_unregister_driver(&tnt4882_pci_driver);
1494
1495
return result;
1496
}
1497
1498
static void __exit tnt4882_exit_module(void)
1499
{
1500
gpib_unregister_driver(&ni_isa_interface);
1501
gpib_unregister_driver(&ni_isa_accel_interface);
1502
gpib_unregister_driver(&ni_nat4882_isa_interface);
1503
gpib_unregister_driver(&ni_nat4882_isa_accel_interface);
1504
gpib_unregister_driver(&ni_nec_isa_interface);
1505
gpib_unregister_driver(&ni_nec_isa_accel_interface);
1506
gpib_unregister_driver(&ni_pci_interface);
1507
gpib_unregister_driver(&ni_pci_accel_interface);
1508
#ifdef CONFIG_GPIB_PCMCIA
1509
gpib_unregister_driver(&ni_pcmcia_interface);
1510
gpib_unregister_driver(&ni_pcmcia_accel_interface);
1511
exit_ni_gpib_cs();
1512
#endif
1513
1514
mite_cleanup();
1515
1516
pci_unregister_driver(&tnt4882_pci_driver);
1517
}
1518
1519
#ifdef CONFIG_GPIB_PCMCIA
1520
1521
#include <linux/kernel.h>
1522
#include <linux/moduleparam.h>
1523
#include <linux/ptrace.h>
1524
#include <linux/timer.h>
1525
#include <linux/io.h>
1526
1527
#include <pcmcia/cistpl.h>
1528
#include <pcmcia/cisreg.h>
1529
#include <pcmcia/ds.h>
1530
1531
static int ni_gpib_config(struct pcmcia_device *link);
1532
static void ni_gpib_release(struct pcmcia_device *link);
1533
static void ni_pcmcia_detach(struct gpib_board *board);
1534
1535
/*
1536
* A linked list of "instances" of the dummy device. Each actual
1537
* PCMCIA card corresponds to one device instance, and is described
1538
* by one dev_link_t structure (defined in ds.h).
1539
*
1540
* You may not want to use a linked list for this -- for example, the
1541
* memory card driver uses an array of dev_link_t pointers, where minor
1542
* device numbers are used to derive the corresponding array index.
1543
*
1544
* I think this dev_list is obsolete but the pointer is needed to keep
1545
* the module instance for the ni_pcmcia_attach function.
1546
*/
1547
1548
static struct pcmcia_device *curr_dev;
1549
1550
struct local_info_t {
1551
struct pcmcia_device *p_dev;
1552
struct gpib_board *dev;
1553
int stop;
1554
struct bus_operations *bus;
1555
};
1556
1557
/*
1558
* ni_gpib_probe() creates an "instance" of the driver, allocating
1559
* local data structures for one device. The device is registered
1560
* with Card Services.
1561
*/
1562
1563
static int ni_gpib_probe(struct pcmcia_device *link)
1564
{
1565
struct local_info_t *info;
1566
//struct struct gpib_board *dev;
1567
1568
/* Allocate space for private device-specific data */
1569
info = kzalloc(sizeof(*info), GFP_KERNEL);
1570
if (!info)
1571
return -ENOMEM;
1572
1573
info->p_dev = link;
1574
link->priv = info;
1575
1576
/*
1577
* General socket configuration defaults can go here. In this
1578
* client, we assume very little, and rely on the CIS for almost
1579
* everything. In most clients, many details (i.e., number, sizes,
1580
* and attributes of IO windows) are fixed by the nature of the
1581
* device, and can be hard-wired here.
1582
*/
1583
link->config_flags = CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
1584
1585
/* Register with Card Services */
1586
curr_dev = link;
1587
return ni_gpib_config(link);
1588
}
1589
1590
/*
1591
* This deletes a driver "instance". The device is de-registered
1592
* with Card Services. If it has been released, all local data
1593
* structures are freed. Otherwise, the structures will be freed
1594
* when the device is released.
1595
*/
1596
static void ni_gpib_remove(struct pcmcia_device *link)
1597
{
1598
struct local_info_t *info = link->priv;
1599
//struct struct gpib_board *dev = info->dev;
1600
1601
if (info->dev)
1602
ni_pcmcia_detach(info->dev);
1603
ni_gpib_release(link);
1604
1605
//free_netdev(dev);
1606
kfree(info);
1607
}
1608
1609
static int ni_gpib_config_iteration(struct pcmcia_device *link, void *priv_data)
1610
{
1611
int retval;
1612
1613
retval = pcmcia_request_io(link);
1614
if (retval != 0)
1615
return retval;
1616
1617
return 0;
1618
}
1619
1620
/*
1621
* ni_gpib_config() is scheduled to run after a CARD_INSERTION event
1622
* is received, to configure the PCMCIA socket, and to make the
1623
* device available to the system.
1624
*/
1625
static int ni_gpib_config(struct pcmcia_device *link)
1626
{
1627
//struct local_info_t *info = link->priv;
1628
//struct gpib_board *dev = info->dev;
1629
int last_ret;
1630
1631
last_ret = pcmcia_loop_config(link, &ni_gpib_config_iteration, NULL);
1632
if (last_ret) {
1633
dev_warn(&link->dev, "no configuration found\n");
1634
ni_gpib_release(link);
1635
return last_ret;
1636
}
1637
1638
last_ret = pcmcia_enable_device(link);
1639
if (last_ret) {
1640
ni_gpib_release(link);
1641
return last_ret;
1642
}
1643
return 0;
1644
} /* ni_gpib_config */
1645
1646
/*
1647
* After a card is removed, ni_gpib_release() will unregister the
1648
* device, and release the PCMCIA configuration. If the device is
1649
* still open, this will be postponed until it is closed.
1650
*/
1651
static void ni_gpib_release(struct pcmcia_device *link)
1652
{
1653
pcmcia_disable_device(link);
1654
} /* ni_gpib_release */
1655
1656
static int ni_gpib_suspend(struct pcmcia_device *link)
1657
{
1658
//struct local_info_t *info = link->priv;
1659
//struct struct gpib_board *dev = info->dev;
1660
1661
if (link->open)
1662
dev_warn(&link->dev, "Device still open\n");
1663
//netif_device_detach(dev);
1664
1665
return 0;
1666
}
1667
1668
static int ni_gpib_resume(struct pcmcia_device *link)
1669
{
1670
//struct local_info_t *info = link->priv;
1671
//struct struct gpib_board *dev = info->dev;
1672
1673
/*if (link->open) {
1674
* ni_gpib_probe(dev); / really?
1675
* //netif_device_attach(dev);
1676
*}
1677
*/
1678
return ni_gpib_config(link);
1679
}
1680
1681
static struct pcmcia_device_id ni_pcmcia_ids[] = {
1682
PCMCIA_DEVICE_MANF_CARD(0x010b, 0x4882),
1683
PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0c71), // NI PCMCIA-GPIB+
1684
PCMCIA_DEVICE_NULL
1685
};
1686
1687
MODULE_DEVICE_TABLE(pcmcia, ni_pcmcia_ids);
1688
1689
static struct pcmcia_driver ni_gpib_cs_driver = {
1690
.name = "ni_gpib_cs",
1691
.owner = THIS_MODULE,
1692
.drv = { .name = "ni_gpib_cs", },
1693
.id_table = ni_pcmcia_ids,
1694
.probe = ni_gpib_probe,
1695
.remove = ni_gpib_remove,
1696
.suspend = ni_gpib_suspend,
1697
.resume = ni_gpib_resume,
1698
};
1699
1700
static int __init init_ni_gpib_cs(void)
1701
{
1702
return pcmcia_register_driver(&ni_gpib_cs_driver);
1703
}
1704
1705
static void __exit exit_ni_gpib_cs(void)
1706
{
1707
pcmcia_unregister_driver(&ni_gpib_cs_driver);
1708
}
1709
1710
static const int pcmcia_gpib_iosize = 32;
1711
1712
static int ni_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config)
1713
{
1714
struct local_info_t *info;
1715
struct tnt4882_priv *tnt_priv;
1716
struct nec7210_priv *nec_priv;
1717
int isr_flags = IRQF_SHARED;
1718
int retval;
1719
1720
if (!curr_dev)
1721
return -ENODEV;
1722
1723
info = curr_dev->priv;
1724
info->dev = board;
1725
1726
board->status = 0;
1727
1728
if (tnt4882_allocate_private(board))
1729
return -ENOMEM;
1730
1731
tnt_priv = board->private_data;
1732
nec_priv = &tnt_priv->nec7210_priv;
1733
nec_priv->type = TNT4882;
1734
nec_priv->read_byte = nec7210_locking_ioport_read_byte;
1735
nec_priv->write_byte = nec7210_locking_ioport_write_byte;
1736
nec_priv->offset = atgpib_reg_offset;
1737
1738
if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]),
1739
DRV_NAME))
1740
return -ENOMEM;
1741
1742
nec_priv->mmiobase = ioport_map(curr_dev->resource[0]->start,
1743
resource_size(curr_dev->resource[0]));
1744
if (!nec_priv->mmiobase)
1745
return -ENOMEM;
1746
1747
// get irq
1748
retval = request_irq(curr_dev->irq, tnt4882_interrupt, isr_flags, DRV_NAME, board);
1749
if (retval) {
1750
dev_err(board->gpib_dev, "failed to obtain PCMCIA irq %d\n", curr_dev->irq);
1751
return retval;
1752
}
1753
tnt_priv->irq = curr_dev->irq;
1754
1755
tnt4882_init(tnt_priv, board);
1756
1757
return 0;
1758
}
1759
1760
static void ni_pcmcia_detach(struct gpib_board *board)
1761
{
1762
struct tnt4882_priv *tnt_priv = board->private_data;
1763
struct nec7210_priv *nec_priv;
1764
1765
if (tnt_priv) {
1766
nec_priv = &tnt_priv->nec7210_priv;
1767
if (tnt_priv->irq)
1768
free_irq(tnt_priv->irq, board);
1769
if (nec_priv->mmiobase)
1770
ioport_unmap(nec_priv->mmiobase);
1771
if (nec_priv->iobase) {
1772
tnt4882_board_reset(tnt_priv, board);
1773
release_region(nec_priv->iobase, pcmcia_gpib_iosize);
1774
}
1775
}
1776
tnt4882_free_private(board);
1777
}
1778
1779
static struct gpib_interface ni_pcmcia_interface = {
1780
.name = "ni_pcmcia",
1781
.attach = ni_pcmcia_attach,
1782
.detach = ni_pcmcia_detach,
1783
.read = tnt4882_accel_read,
1784
.write = tnt4882_accel_write,
1785
.command = tnt4882_command,
1786
.take_control = tnt4882_take_control,
1787
.go_to_standby = tnt4882_go_to_standby,
1788
.request_system_control = tnt4882_request_system_control,
1789
.interface_clear = tnt4882_interface_clear,
1790
.remote_enable = tnt4882_remote_enable,
1791
.enable_eos = tnt4882_enable_eos,
1792
.disable_eos = tnt4882_disable_eos,
1793
.parallel_poll = tnt4882_parallel_poll,
1794
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1795
.parallel_poll_response = tnt4882_parallel_poll_response,
1796
.local_parallel_poll_mode = NULL, // XXX
1797
.line_status = tnt4882_line_status,
1798
.update_status = tnt4882_update_status,
1799
.primary_address = tnt4882_primary_address,
1800
.secondary_address = tnt4882_secondary_address,
1801
.serial_poll_response = tnt4882_serial_poll_response,
1802
.serial_poll_status = tnt4882_serial_poll_status,
1803
.t1_delay = tnt4882_t1_delay,
1804
.return_to_local = tnt4882_return_to_local,
1805
};
1806
1807
static struct gpib_interface ni_pcmcia_accel_interface = {
1808
.name = "ni_pcmcia_accel",
1809
.attach = ni_pcmcia_attach,
1810
.detach = ni_pcmcia_detach,
1811
.read = tnt4882_accel_read,
1812
.write = tnt4882_accel_write,
1813
.command = tnt4882_command,
1814
.take_control = tnt4882_take_control,
1815
.go_to_standby = tnt4882_go_to_standby,
1816
.request_system_control = tnt4882_request_system_control,
1817
.interface_clear = tnt4882_interface_clear,
1818
.remote_enable = tnt4882_remote_enable,
1819
.enable_eos = tnt4882_enable_eos,
1820
.disable_eos = tnt4882_disable_eos,
1821
.parallel_poll = tnt4882_parallel_poll,
1822
.parallel_poll_configure = tnt4882_parallel_poll_configure,
1823
.parallel_poll_response = tnt4882_parallel_poll_response,
1824
.local_parallel_poll_mode = NULL, // XXX
1825
.line_status = tnt4882_line_status,
1826
.update_status = tnt4882_update_status,
1827
.primary_address = tnt4882_primary_address,
1828
.secondary_address = tnt4882_secondary_address,
1829
.serial_poll_response = tnt4882_serial_poll_response,
1830
.serial_poll_status = tnt4882_serial_poll_status,
1831
.t1_delay = tnt4882_t1_delay,
1832
.return_to_local = tnt4882_return_to_local,
1833
};
1834
1835
#endif // CONFIG_GPIB_PCMCIA
1836
1837
module_init(tnt4882_init_module);
1838
module_exit(tnt4882_exit_module);
1839
1840