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;
}
/**
// Sanity Check Length
if(Length > TX_BUF_SIZE*256) {
Warning(
- "Ne2k_Write - Attempting to send over TX_BUF_SIZE(%i) bytes (%i)",
+ "Ne2k_Write - Attempting to send over TX_BUF_SIZE*256 (%i) bytes (%i)",
TX_BUF_SIZE*256, Length
);
LEAVE('i', 0);
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();