int NextMemPage; //!< Next Card Memory page to use
- Uint8 Buffer[RX_BUF_SIZE];
+ Uint8 Buffer[RX_BUF_SIZE*256];
char Name[2]; // "0"
tVFS_Node Node;
giNe2k_CardCount += PCI_CountDevices( csaCOMPAT_DEVICES[i].Vendor, csaCOMPAT_DEVICES[i].Device, 0 );
}
+ if( giNe2k_CardCount == 0 ) {
+ Log("[Ne2k ] No cards detected\n");
+ return MODULE_ERR_NOTNEEDED;
+ }
+
// Enumerate Cards
k = 0;
gpNe2k_Cards = calloc( giNe2k_CardCount, sizeof(tCard) );
gNe2k_DriverInfo.RootNode.Size = giNe2k_CardCount;
DevFS_AddDevice( &gNe2k_DriverInfo );
- return 1;
+ return MODULE_ERR_OK;
}
/**
tCard *Card = (tCard*)Node->ImplPtr;
Uint16 *buf = Buffer;
int rem = Length;
+ int page;
ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
// Sanity Check Length
- if(Length > TX_BUF_SIZE) {
+ if(Length > TX_BUF_SIZE*256) {
+ Warning(
+ "Ne2k_Write - Attempting to send over TX_BUF_SIZE*256 (%i) bytes (%i)",
+ TX_BUF_SIZE*256, Length
+ );
LEAVE('i', 0);
return 0;
}
// Set up transfer
outb(Card->IOBase + RSAR0, 0x00); // Page Offset
- outb(Card->IOBase + RSAR1, Ne2k_int_GetWritePage(Card, Length)); // Page Offset
+ page = Ne2k_int_GetWritePage(Card, Length);
+ outb(Card->IOBase + RSAR1, page); // Page Offset
// Start
//outb(Card->IOBase + CMD, 0|0x18|0x4|0x2); // Page 0, Transmit Packet, TXP, Start
outb(Card->IOBase + CMD, 0|0x10|0x2); // Page 0, Remote Write, Start
// Send Data
- for(rem = Length; rem; rem -= 2)
+ for(rem = Length; rem > 0; rem -= 2) {
outw(Card->IOBase + 0x10, *buf++);
+ }
while( inb(Card->IOBase + ISR) == 0 ) // Wait for Remote DMA Complete
; //Proc_Yield();
outb( Card->IOBase + ISR, 0x40 ); // ACK Interrupt
// Send Packet
+ outb(Card->IOBase + TPSR, page);
outb(Card->IOBase + CMD, 0|0x10|0x4|0x2);
// Complete DMA