+int Ne2k_int_ReadDMA(tCard *Card, int FirstPage, int NumPages, void *Buffer)
+{
+ int i;
+
+ // Sanity check
+ if( !(0 <= FirstPage && FirstPage < 256) ) {
+ Log_Warning("NE2000", "Ne2k_int_ReadDMA: BUG - FirstPage(%i) not 8-bit", FirstPage);
+ return -1;
+ }
+ if( !(0 <= NumPages && NumPages < 256) ) {
+ Log_Warning("NE2000", "Ne2k_int_ReadDMA: BUG - NumPages(%i) not 8-bit", NumPages);
+ return -1;
+ }
+
+ ENTER("pCard iFirstPage iNumPages pBuffer", Card, FirstPage, NumPages, Buffer);
+
+ // Make sure that the card is in bank 0
+ outb(Card->IOBase + CMD, 0|0x22); // Bank 0, Start, NoDMA
+ outb(Card->IOBase + ISR, 0x40); // Clear Remote DMA Flag
+
+ // Set up transfer
+ outb(Card->IOBase + RBCR0, 0);
+ outb(Card->IOBase + RBCR1, NumPages); // page count
+ outb(Card->IOBase + RSAR0, 0x00); // Page Offset
+ outb(Card->IOBase + RSAR1, FirstPage); // Page Number
+ outb(Card->IOBase + CMD, 0|0x08|0x2); // Bank 0, Remote Read, Start
+
+ // TODO: Less expensive
+ //while( !(inb(Card->IOBase + ISR) & 0x40) ) {
+ // HALT();
+ // LOG("inb(ISR) = 0x%02x", inb(Card->IOBase + ISR));
+ //}
+ HALT(); // Small delay?
+
+ // Read data
+ for(i = 0; i < 128*NumPages; i ++)
+ ((Uint16*)Buffer)[i] = inw(Card->IOBase + 0x10);
+
+
+ outb(Card->IOBase + ISR, 0x40); // Clear Remote DMA Flag
+
+ LEAVE('i', NumPages);
+ return NumPages;
+}
+