summaryrefslogtreecommitdiffstats
path: root/private/ntos/ndis/wd/wdhrd.h
blob: 6574d6e07fd8bdb7a0483eae7301d2cfe199a681 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
/*++

Copyright (c) 1990  Microsoft Corporation

Module Name:

    wdhrd.h

Abstract:

    The main program for an Western Digital MAC driver.

Author:

    Anthony V. Ercolano (tonye) creation-date 19-Jun-1990 (Driver model)

    Orginal Elnkii code by AdamBa.

    Modified for WD by SeanSe.

Environment:

    This driver is expected to work in DOS, OS2 and NT at the equivalent
    of kernal mode.

    Architecturally, there is an assumption in this driver that we are
    on a little endian machine.

Notes:

    optional-notes

Revision History:


--*/

#ifndef _WDHARDWARE_
#define _WDHARDWARE_



// Adapter->IoBaseAddr
//
// must match the setting of I/O Base Address jumper on
// the card. Choices are 0x300 and 0x280
//

#define DEFAULT_IOBASEADDR (USHORT)0x280



// Adapter->MaxOpens
//
// the maximum number of protocols that may be bound to this
// adapter at one time.

#define DEFAULT_MAXOPENS 4



// Adapter->MulticastListMax
//
// the maximum number of different multicast addresses that
// may be specified to this adapter (the list is global for
// all protocols).

#define DEFAULT_MULTICASTLISTMAX 16


//
// The maximum packet transmittable.
//

#define WD_MAX_PACKET_SIZE 1514


















//
// Offsets from Adapter->IoPAddr of the ports used to access
// the 8390 NIC registers.
//
// The names in parenthesis are the abbreviations by which
// the registers are referred to in the 8390 data sheet.
//
// Some of the offsets appear more than once
// because they have have relevant page 0 and page 1 values,
// or they are different registers when read than they are
// when written. The notation MSB indicates that only the
// MSB can be set for this register, the LSB is assumed 0.
//

#define NIC_COMMAND         0x0     // (CR)
#define NIC_PAGE_START      0x1     // (PSTART)   MSB, write-only
#define NIC_PHYS_ADDR       0x1     // (PAR0)     page 1
#define NIC_PAGE_STOP       0x2     // (PSTOP)    MSB, write-only
#define NIC_BOUNDARY        0x3     // (BNRY)     MSB
#define NIC_XMIT_START      0x4     // (TPSR)     MSB, write-only
#define NIC_XMIT_STATUS     0x4     // (TSR)      read-only
#define NIC_XMIT_COUNT_LSB  0x5     // (TBCR0)    write-only
#define NIC_XMIT_COUNT_MSB  0x6     // (TBCR1)    write-only
#define NIC_FIFO            0x6     // (FIFO)     read-only
#define NIC_INTR_STATUS     0x7     // (ISR)
#define NIC_CURRENT         0x7     // (CURR)     page 1
#define NIC_MC_ADDR         0x8     // (MAR0)     page 1
#define NIC_RMT_COUNT_LSB   0xa     // (RBCR0)    write-only
#define NIC_RMT_COUNT_MSB   0xb     // (RBCR1)    write-only
#define NIC_RCV_CONFIG      0xc     // (RCR)      write-only
#define NIC_RCV_STATUS      0xc     // (RSR)      read-only
#define NIC_XMIT_CONFIG     0xd     // (TCR)      write-only
#define NIC_FAE_ERR_CNTR    0xd     // (CNTR0)    read-only
#define NIC_DATA_CONFIG     0xe     // (DCR)      write-only
#define NIC_CRC_ERR_CNTR    0xe     // (CNTR1)    read-only
#define NIC_INTR_MASK       0xf     // (IMR)      write-only
#define NIC_MISSED_CNTR     0xf     // (CNTR2)    read-only


//
// Constants for the NIC_COMMAND register.
//
// Start/stop the card, start transmissions, and select
// which page of registers was seen through the ports.
//

#define CR_STOP         (UCHAR)0x01        // reset the card
#define CR_START        (UCHAR)0x02        // start the card
#define CR_XMIT         (UCHAR)0x04        // begin transmission
#define CR_NO_DMA       (UCHAR)0x20        // stop remote DMA

#define CR_PS0          (UCHAR)0x40        // low bit of page number
#define CR_PS1          (UCHAR)0x80        // high bit of page number
#define CR_PAGE0        (UCHAR)0x00        // select page 0
#define CR_PAGE1        CR_PS0             // select page 1
#define CR_PAGE2        CR_PS1             // select page 2


//
// Constants for the NIC_XMIT_STATUS register.
//
// Indicate the result of a packet transmission.
//

#define TSR_XMIT_OK     (UCHAR)0x01        // transmit with no errors
#define TSR_COLLISION   (UCHAR)0x04        // collided at least once
#define TSR_ABORTED     (UCHAR)0x08        // too many collisions
#define TSR_NO_CARRIER  (UCHAR)0x10        // carrier lost
#define TSR_NO_CDH      (UCHAR)0x40        // no collision detect heartbeat


//
// Constants for the NIC_INTR_STATUS register.
//
// Indicate the cause of an interrupt.
//

#define ISR_RCV         (UCHAR)0x01        // packet received with no errors
#define ISR_XMIT        (UCHAR)0x02        // packet transmitted with no errors
#define ISR_RCV_ERR     (UCHAR)0x04        // error on packet reception
#define ISR_XMIT_ERR    (UCHAR)0x08        // error on packet transmission
#define ISR_OVERFLOW    (UCHAR)0x10        // receive buffer overflow
#define ISR_COUNTER     (UCHAR)0x20        // MSB set on tally counter
#define ISR_RESET       (UCHAR)0x80        // (not an interrupt) card is reset


//
// Constants for the NIC_RCV_CONFIG register.
//
// Configure what type of packets are received.
//

#define RCR_REJECT_ERR  (UCHAR)0x00        // reject error packets
#define RCR_BROADCAST   (UCHAR)0x04        // receive broadcast packets
#define RCR_MULTICAST   (UCHAR)0x08        // receive multicast packets
#define RCR_ALL_PHYS    (UCHAR)0x10        // receive ALL directed packets


//
// Constants for the NIC_RCV_STATUS register.
//
// Indicate the status of a received packet.
//
// These are also used to interpret the status byte in the
// packet header of a received packet.
//

#define RSR_PACKET_OK   (UCHAR)0x01        // packet received with no errors
#define RSR_CRC_ERROR   (UCHAR)0x02        // packet received with CRC error
#define RSR_MULTICAST   (UCHAR)0x20        // packet received was multicast
#define RSR_DISABLED    (UCHAR)0x40        // received is disabled
#define RSR_DEFERRING   (UCHAR)0x80        // receiver is deferring


//
// Constants for the NIC_XMIT_CONFIG register.
//
// Configures how packets are transmitted.
//

#define TCR_NO_LOOPBACK (UCHAR)0x00        // normal operation
#define TCR_LOOPBACK    (UCHAR)0x02        // loopback (set when NIC is stopped)

#define TCR_INHIBIT_CRC (UCHAR)0x01        // inhibit appending of CRC

#define TCR_NIC_LBK     (UCHAR)0x02        // loopback through the NIC
#define TCR_SNI_LBK     (UCHAR)0x04        // loopback through the SNI
#define TCR_COAX_LBK    (UCHAR)0x06        // loopback to the coax


//
// Constants for the NIC_DATA_CONFIG register.
//
// Set data transfer sizes.
//

#define DCR_BYTE_WIDE   (UCHAR)0x00        // byte-wide DMA transfers
#define DCR_WORD_WIDE   (UCHAR)0x01        // word-wide DMA transfers

#define DCR_LOOPBACK    (UCHAR)0x00        // loopback mode (TCR must be set)
#define DCR_NORMAL      (UCHAR)0x08        // normal operation

#define DCR_FIFO_8_BYTE (UCHAR)0x40        // 8-byte FIFO threshhold


//
// Constants for the NIC_INTR_MASK register.
//
// Configure which ISR settings actually cause interrupts.
//

#define IMR_RCV         (UCHAR)0x01        // packet received with no errors
#define IMR_XMIT        (UCHAR)0x02        // packet transmitted with no errors
#define IMR_RCV_ERR     (UCHAR)0x04        // error on packet reception
#define IMR_XMIT_ERR    (UCHAR)0x08        // error on packet transmission
#define IMR_OVERFLOW    (UCHAR)0x10        // receive buffer overflow
#define IMR_COUNTER     (UCHAR)0x20        // MSB set on tally counter



//
// Offsets from Adapter->GaPAddr (which is Adapter->IoPAddr+0x400)
// of the ports used to access the Elnkii Gate Array registers.
//
// The names in parenthesis are the abbreviations by which
// the registers are referred to in the Elnkii Technical
// Reference.
//

#define GA_PAGE_START       0x0     // (PSTR)     MSB
#define GA_PAGE_STOP        0x1     // (PSPR)     MSB
#define GA_DRQ_TIMER        0x2     // (DQTR)
#define GA_IO_BASE          0x3     // (BCFR)     read-only
#define GA_MEM_BASE         0x4     // (PCFR)     read-only
#define GA_CONFIG           0x5     // (GACFR)
#define GA_CONTROL          0x6     // (CTRL)
#define GA_STATUS           0x7     // (STREG)    read-only
#define GA_INT_DMA_CONFIG   0x8     // (IDCFR)
#define GA_DMA_ADDR_MSB     0x9     // (DAMSB)
#define GA_DMA_ADDR_LSB     0xa     // (DALSB)
#define GA_REG_FILE_MSB     0xe     // (RFMSB)
#define GA_REG_FILE_LSB     0xf     // (RFLSB)


//
// Constants for the GA_DRQ_TIMER register.
//

#define DQTR_16_BYTE    (UCHAR)0x10        // 16-byte programmed I/O bursts
#define DQTR_8_BYTE     (UCHAR)0x08        // 8-byte programmed I/O bursts


//
// Constants for the GA_CONFIG register.
//

#define GACFR_TC_MASK   (UCHAR)0x40        // block DMA complete interrupts
#define GACFR_RAM_SEL   (UCHAR)0x08        // allow memory-mapped mode
#define GACFR_MEM_BANK1 (UCHAR)0x01        // select window for 8K buffer


//
// Constants for the GA_CONTROL register.
//

#define CTRL_START      (UCHAR)0x80        // start the DMA controller
#define CTRL_STOP       (UCHAR)0x00        // stop the DMA controller

#define CTRL_DIR_DOWN   (UCHAR)0x40        // system->board transfers
#define CTRL_DIR_UP     (UCHAR)0x00        // board->system transfers

#define CTRL_DB_SEL     (UCHAR)0x20        // connect FIFOs serially

#define CTRL_PROM_SEL   (UCHAR)0x04        // window PROM into GaPAddr ports
#define CTRL_GA_SEL     (UCHAR)0x00        // window GA into GaPAddr ports

#define CTRL_BNC        (UCHAR)0x02        // internal tranceiver
#define CTRL_DIX        (UCHAR)0x00        // external tranceiver

#define CTRL_RESET      (UCHAR)0x01        // emulate power up reset


//
// Constants for the GA_STATUS register.
//

#define STREG_DP_READY  (UCHAR)0x80        // ready for programmed I/O transfer
#define STREG_UNDERFLOW (UCHAR)0x40        // register file underflow
#define STREG_OVERFLOW  (UCHAR)0x20        // register file overflow
#define STREG_IN_PROG   (UCHAR)0x08        // programmed I/O in progress




//++
//
// VOID
// CardStartXmit(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Starts a packet transmission. The transmit buffer number is
//  taken from Adapter->CurBufXmitting and the length of the packet
//  is taken from Adapter->PacketLens[Adapter->CurBufXmitting].
//  Calls SyncCardStartXmit.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardStartXmit(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardStartXmit, (PVOID)(Adapter))


//++
//
// VOID
// CardWriteMulticast(
//     IN PELNKII_ADAPTER Adapter,
//     IN UCHAR Byte
//     )
//
// Routine Description:
//
//  Writes a single byte to the multicast address register bit mask.
//  Calls SyncCardWriteMulticast. Byte indicates which byte to
//  write (0-7); the actual value to write is taken from
//  Adapter->NicMulticastRegs[Byte].
//
// Arguments:
//
//  Adapter - The adapter block.
//  Byte - Which multicast byte to write.
//
// Return Value:
//
//  None.
//
//--

#define CardWriteMulticast(Adapter, Byte) \
    (Adapter)->ByteToWrite = Byte, \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardWriteMulticast, (PVOID)(Adapter))


//++
//
// VOID
// CardSetAllMulticast(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Enables every bit in the card multicast bit mask.
//  Calls SyncCardSetAllMulticast.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardSetAllMulticast(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardSetAllMulticast, (PVOID)(Adapter))


//++
//
// VOID
// CardCopyMulticastRegs(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Writes out the entire multicast bit mask to the card from
//  Adapter->NicMulticastRegs.  Calls SyncCardCopyMulticastRegs.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardCopyMulticastRegs(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardCopyMulticastRegs, (PVOID)(Adapter))


//++
//
// VOID
// CardCopyPhysicalAddress(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Writes out the physical address to the card. The value is
//  read from Adapter->StationAddress. Calls SyncCardCopyPhysicalAddress.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardCopyPhysicalAddress(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardCopyPhysicalAddress, (PVOID)(Adapter))


//++
//
// VOID
// CardGetInterruptStatus(
//     IN PELNKII_ADAPTER Adapter,
//     OUT PUCHAR InterrupStatus
//     )
//
// Routine Description:
//
//  Reads the interrupt status (ISR) register from the card. Only
//  called at IRQL INTERRUPT_LEVEL.
//
// Arguments:
//
//  Adapter - The adapter block.
//
//  InterruptStatus - Returns the value of ISR.
//
// Return Value:
//
//--

#define CardGetInterruptStatus(Adapter,InterruptStatus) \
    NdisReadPortUchar((Adapter)->NdisAdapterHandle, (Adapter)->IoPAddr+NIC_INTR_STATUS, (InterruptStatus))


//++
//
// UCHAR
// CardGetXmitStatus(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Reads the transmit status (TSR) register from the card.
//  Calls SyncCardGetXmitStatus.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  The value of TSR.
//
//--

#define CardGetXmitStatus(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardGetXmitStatus, (PVOID)(Adapter))


//++
//
// UCHAR
// CardGetCurrent(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Reads the current (CURR) register from the card.
//  Calls SyncCardGetCurrent.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  The value of CURR.
//
//--

#define CardGetCurrent(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardGetCurrent, (PVOID)(Adapter))


//++
//
// VOID
// CardSetBoundary(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Sets the boundary (BNRY) register on the card. The value used
//  is one before Adapter->NicNextPacket. Calls SyncCardSetBoundary.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardSetBoundary(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardSetBoundary, (PVOID)(Adapter))


//++
//
// VOID
// CardSetReceiveConfig(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Sets the receive configuration (RCR) register on the card.
//  The value used is Adapter->NicReceiveConfig. Calls
//  SyncCardSetReceiveConfig.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardSetReceiveConfig(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardSetReceiveConfig, (PVOID)(Adapter))


//++
//
// VOID
// CardBlockInterrupts(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Blocks all interrupts from the card by clearing the
//  interrupt mask (IMR) register. Only called from
//  IRQL INTERRUPT_LEVEL.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardBlockInterrupts(Adapter) \
    NdisWritePortUchar((Adapter)->NdisAdapterHandle, (Adapter)->IoPAddr+NIC_INTR_MASK, 0)


//++
//
// VOID
// CardUnblockInterrupts(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Unblocks all interrupts from the card by setting the
//  interrupt mask (IMR) register. Only called from IRQL
//  INTERRUPT_LEVEL.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardUnblockInterrupts(Adapter) \
    NdisWritePortUchar((Adapter)->NdisAdapterHandle, \
            (Adapter)->IoPAddr+NIC_INTR_MASK, \
            (Adapter)->NicInterruptMask)


//++
//
// VOID
// CardDisableReceiveInterrupt(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Turns off the receive bit in Adapter->NicInterruptMask.
//  This function is only called when CardBlockInterrupts have
//  been called; it ensures that receive interrupts are not
//  reenabled until CardEnableReceiveInterrupt is called, even
//  if CardUnblockInterrupts is called.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardDisableReceiveInterrupt(Adapter) \
    (Adapter)->NicInterruptMask &= (UCHAR)~IMR_RCV


//++
//
// VOID
// CardEnableReceiveInterrupt(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Reenables receive interrupts by setting the receive bit ibn
//  Adapter->NicInterruptMask, and also writes the new value to
//  the card. Calls SyncCardSetInterruptMask.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardEnableReceiveInterrupt(Adapter) \
    (Adapter)->NicInterruptMask |= (UCHAR)IMR_RCV, \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardSetInterruptMask, (PVOID)(Adapter))


//++
//
// VOID
// CardAcknowledgeReceiveInterrupt(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Acknowledges a receive interrupt by setting the bit in
//  the interrupt status (ISR) register. Calls
//  SyncCardAcknowledgeReceive.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardAcknowledgeReceiveInterrupt(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardAcknowledgeReceive, (PVOID)(Adapter))


//++
//
// VOID
// CardAcknowledgeOverflowInterrupt(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Acknowledges an overflow interrupt by setting the bit in
//  the interrupt status (ISR) register. Calls
//  SyncCardAcknowledgeOverflow.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardAcknowledgeOverflowInterrupt(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardAcknowledgeOverflow, (PVOID)(Adapter))


//++
//
// VOID
// CardAcknowledgeTransmitInterrupt(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Acknowledges a transmit interrupt by setting the bit in
//  the interrupt status (ISR) register. Calls
//  SyncCardAcknowledgeTransmit.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardAcknowledgeTransmitInterrupt(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardAcknowledgeTransmit, (PVOID)(Adapter))


//++
//
// VOID
// CardAcknowledgeCounterInterrupt(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Acknowledges a counter interrupt by setting the bit in
//  the interrupt status (ISR) register.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardAcknowledgeCounterInterrupt(Adapter) \
    NdisWritePortUchar((Adapter)->NdisAdapterHandle, (Adapter)->IoPAddr+NIC_INTR_STATUS, ISR_COUNTER)


//++
//
// VOID
// CardAckAndGetCurrent(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Performs the function of CardAcknowledgeReceive followed by
//  CardGetCurrent (since the two are always called
//  one after the other). Calls SyncCardAckAndGetCurrent.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardAckAndGetCurrent(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
               SyncCardAckAndGetCurrent, (PVOID)(Adapter))


//++
//
// VOID
// CardGetXmitStatusAndAck(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Performs the function of CardGetXmitStatus followed by
//  CardAcknowledgeTransmit (since the two are always called
//  one after the other). Calls SyncCardGetXmitStatusAndAck.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardGetXmitStatusAndAck(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardGetXmitStatusAndAck, (PVOID)(Adapter))


//++
//
// VOID
// CardUpdateCounters(
//     IN PELNKII_ADAPTER Adapter
//     )
//
// Routine Description:
//
//  Updates the values of the three counters (frame alignment
//  errors, CRC errors, and missed packets) by reading in their
//  current values from the card and adding them to the ones
//  stored in the Adapter structure. Calls SyncCardUpdateCounters.
//
// Arguments:
//
//  Adapter - The adapter block.
//
// Return Value:
//
//  None.
//
//--

#define CardUpdateCounters(Adapter) \
    NdisSynchronizeWithInterrupt(&(Adapter)->NdisInterrupt, \
                SyncCardUpdateCounters, (PVOID)(Adapter))


#endif // _ELNKIIHARDWARE_