Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1491 → Rev 1492

/kernel/branches/net/drivers/RTL8139.asm
29,7 → 29,7
include 'fdo.inc'
include 'netdrv.inc'
 
OS_BASE equ 0;
OS_BASE equ 0
new_app_base equ 0x60400000
PROC_BASE equ OS_BASE+0x0080000
 
38,24 → 38,12
public version
 
 
struc ETH_DEVICE {
; pointers to procedures
.unload dd ?
.reset dd ?
.transmit dd ?
.set_MAC dd ?
.get_MAC dd ?
.set_mode dd ?
.get_mode dd ?
; status & variables
.bytes_tx dq ?
.bytes_rx dq ?
.packets_tx dd ?
.packets_rx dd ?
.mode dd ? ; This dword contains cable status (10mbit/100mbit, full/half duplex, auto negotiation or not,..)
.name dd ?
.mac dp ?
; device specific
virtual at ebx
 
device:
 
ETH_DEVICE
 
.rx_buffer dd ?
.tx_buffer dd ?
.rx_data_offset dd ?
68,12 → 56,9
 
.size = $ - device
 
}
 
virtual at ebx
device ETH_DEVICE
end virtual
 
 
; RTL8139 specific defines
 
MAX_RTL8139 equ 16 ; Max number of devices this driver may handle
334,7 → 319,7
jge .fail
 
push edx
stdcall KernelAlloc, dword device.size ; Allocate the buffer for eth_device structure
stdcall KernelAlloc, device.size ; Allocate the buffer for eth_device structure
pop edx
test eax, eax
jz .fail
358,18 → 343,12
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
; TODO: implement check if bus and dev exist on this machine
 
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
movzx eax, byte [device.pci_bus]
movzx ecx, byte [device.pci_dev]
push ebx
stdcall PciRead8, eax ,ecx ,0x3c ; 0x3c is the offset where irq can be found
pop ebx
mov byte [device.irq_line], al
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
DEBUGF 2,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\
[device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4