Better debug output for RTL8029 and RTL8139 driver.
git-svn-id: svn://kolibrios.org@3856 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
da3583db82
commit
da3849b613
|
@ -25,7 +25,7 @@ format MS COFF
|
||||||
|
|
||||||
DEBUG = 1
|
DEBUG = 1
|
||||||
__DEBUG__ = 1
|
__DEBUG__ = 1
|
||||||
__DEBUG_LEVEL__ = 2
|
__DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only
|
||||||
|
|
||||||
include '../proc32.inc'
|
include '../proc32.inc'
|
||||||
include '../imports.inc'
|
include '../imports.inc'
|
||||||
|
@ -169,7 +169,7 @@ proc START stdcall, state:dword
|
||||||
cmp [state], 1
|
cmp [state], 1
|
||||||
jne .exit
|
jne .exit
|
||||||
.entry:
|
.entry:
|
||||||
DEBUGF 2,"Registering %s driver\n", my_service
|
DEBUGF 1, "Loading driver\n"
|
||||||
stdcall RegService, my_service, service_proc
|
stdcall RegService, my_service, service_proc
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
|
@ -210,7 +210,7 @@ proc service_proc stdcall, ioctl:dword
|
||||||
cmp eax, 1 ;SRV_HOOK
|
cmp eax, 1 ;SRV_HOOK
|
||||||
jne @F ;---------
|
jne @F ;---------
|
||||||
|
|
||||||
DEBUGF 1,"Checking if device is already listed..\n"
|
DEBUGF 1, "Checking if device is already listed..\n"
|
||||||
|
|
||||||
mov eax, [IOCTL.input]
|
mov eax, [IOCTL.input]
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ proc service_proc stdcall, ioctl:dword
|
||||||
|
|
||||||
.hook:
|
.hook:
|
||||||
|
|
||||||
DEBUGF 2,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\
|
DEBUGF 1, "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
|
[device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4
|
||||||
|
|
||||||
call probe ; this function will output in eax
|
call probe ; this function will output in eax
|
||||||
|
@ -318,15 +318,15 @@ proc service_proc stdcall, ioctl:dword
|
||||||
; If the device was already loaded, find the device number and return it in eax
|
; If the device was already loaded, find the device number and return it in eax
|
||||||
|
|
||||||
.find_devicenum:
|
.find_devicenum:
|
||||||
DEBUGF 1,"Trying to find device number of already registered device\n"
|
DEBUGF 1, "Trying to find device number of already registered device\n"
|
||||||
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
||||||
; into a device number in edi
|
; into a device number in edi
|
||||||
mov eax, edi ; Application wants it in eax instead
|
mov eax, edi ; Application wants it in eax instead
|
||||||
DEBUGF 1,"Kernel says: %u\n", eax
|
DEBUGF 1, "Kernel says: %u\n", eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
DEBUGF 1,"Failed, removing device structure\n"
|
DEBUGF 2, "Failed, removing device structure\n"
|
||||||
stdcall KernelFree, ebx
|
stdcall KernelFree, ebx
|
||||||
|
|
||||||
jmp .fail
|
jmp .fail
|
||||||
|
@ -362,12 +362,12 @@ create_new_struct:
|
||||||
|
|
||||||
find_device_num:
|
find_device_num:
|
||||||
|
|
||||||
DEBUGF 1,"Trying to find device number of already registered device\n"
|
DEBUGF 1, "Trying to find device number of already registered device\n"
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
||||||
; into a device number in edi
|
; into a device number in edi
|
||||||
mov eax, edi ; Application wants it in eax instead
|
mov eax, edi ; Application wants it in eax instead
|
||||||
DEBUGF 1,"Kernel says: %u\n", eax
|
DEBUGF 1, "Kernel says: %u\n", eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ probe:
|
||||||
mov [device.vendor], VENDOR_NONE
|
mov [device.vendor], VENDOR_NONE
|
||||||
mov [device.bmem], 0
|
mov [device.bmem], 0
|
||||||
|
|
||||||
DEBUGF 2,"Trying 16-bit mode\n"
|
DEBUGF 1, "Trying 16-bit mode\n"
|
||||||
|
|
||||||
mov [device.flags], FLAG_16BIT + FLAG_PIO
|
mov [device.flags], FLAG_16BIT + FLAG_PIO
|
||||||
mov [device.memsize], MEM_32k
|
mov [device.memsize], MEM_32k
|
||||||
|
@ -432,8 +432,8 @@ probe:
|
||||||
repe cmpsb
|
repe cmpsb
|
||||||
je ep_set_vendor
|
je ep_set_vendor
|
||||||
|
|
||||||
DEBUGF 2,"16-bit mode failed\n"
|
DEBUGF 1, "16-bit mode failed\n"
|
||||||
DEBUGF 2,"Trying 8-bit mode\n"
|
DEBUGF 1, "Trying 8-bit mode\n"
|
||||||
|
|
||||||
mov [device.flags], FLAG_PIO
|
mov [device.flags], FLAG_PIO
|
||||||
mov [device.memsize], MEM_16k
|
mov [device.memsize], MEM_16k
|
||||||
|
@ -484,25 +484,25 @@ probe:
|
||||||
repe cmpsb
|
repe cmpsb
|
||||||
je ep_set_vendor
|
je ep_set_vendor
|
||||||
|
|
||||||
DEBUGF 2,"This is not a valid ne2000 device!\n"
|
DEBUGF 2, "This is not a valid ne2000 device!\n"
|
||||||
or eax, -1
|
or eax, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
ep_set_vendor:
|
ep_set_vendor:
|
||||||
|
|
||||||
DEBUGF 2,"Mode ok\n"
|
DEBUGF 1, "Mode ok\n"
|
||||||
|
|
||||||
cmp [device.io_addr], ISA_MAX_ADDR
|
cmp [device.io_addr], ISA_MAX_ADDR
|
||||||
jbe .isa
|
jbe .isa
|
||||||
|
|
||||||
DEBUGF 2,"Card is using PCI bus\n"
|
DEBUGF 1, "Card is using PCI bus\n"
|
||||||
|
|
||||||
mov [device.vendor], VENDOR_NOVELL ;;; FIXME
|
mov [device.vendor], VENDOR_NOVELL ;;; FIXME
|
||||||
jmp ep_check_have_vendor
|
jmp ep_check_have_vendor
|
||||||
|
|
||||||
.isa:
|
.isa:
|
||||||
DEBUGF 2,"Card is using ISA bus\n"
|
DEBUGF 1, "Card is using ISA bus\n"
|
||||||
|
|
||||||
mov [device.vendor], VENDOR_NOVELL
|
mov [device.vendor], VENDOR_NOVELL
|
||||||
|
|
||||||
|
@ -526,12 +526,18 @@ ep_check_have_vendor:
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
DEBUGF 2,"Resetting device\n"
|
DEBUGF 1, "Resetting device\n"
|
||||||
|
|
||||||
; attach int handler
|
; attach int handler
|
||||||
movzx eax, [device.irq_line]
|
movzx eax, [device.irq_line]
|
||||||
DEBUGF 1,"Attaching int handler to irq %x\n", eax:1
|
DEBUGF 1, "Attaching int handler to irq %x\n", eax:1
|
||||||
stdcall AttachIntHandler, eax, int_handler, dword 0
|
stdcall AttachIntHandler, eax, int_handler, dword 0
|
||||||
|
test eax, eax
|
||||||
|
jnz @f
|
||||||
|
DEBUGF 2, "Could not attach int handler!\n"
|
||||||
|
; or eax, -1
|
||||||
|
; ret
|
||||||
|
@@:
|
||||||
|
|
||||||
; Stop card + DMA
|
; Stop card + DMA
|
||||||
set_io 0
|
set_io 0
|
||||||
|
@ -656,7 +662,7 @@ reset:
|
||||||
|
|
||||||
; Indicate that we have successfully reset the card
|
; Indicate that we have successfully reset the card
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
DEBUGF 1,"Done!\n"
|
DEBUGF 1, "Done!\n"
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -673,8 +679,8 @@ transmit:
|
||||||
|
|
||||||
mov esi, [esp + 4]
|
mov esi, [esp + 4]
|
||||||
mov ecx, [esp + 8]
|
mov ecx, [esp + 8]
|
||||||
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",esi, ecx
|
DEBUGF 1, "Transmitting packet, buffer:%x, size:%u\n",esi, ecx
|
||||||
DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
|
DEBUGF 1, "To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
|
||||||
[esi+0]:2,[esi+1]:2,[esi+2]:2,[esi+3]:2,[esi+4]:2,[esi+5]:2,[esi+6]:2,[esi+7]:2,[esi+8]:2,[esi+9]:2,[esi+10]:2,[esi+11]:2,[esi+13]:2,[esi+12]:2
|
[esi+0]:2,[esi+1]:2,[esi+2]:2,[esi+3]:2,[esi+4]:2,[esi+5]:2,[esi+6]:2,[esi+7]:2,[esi+8]:2,[esi+9]:2,[esi+10]:2,[esi+11]:2,[esi+13]:2,[esi+12]:2
|
||||||
|
|
||||||
cmp ecx, ETH_FRAME_LEN
|
cmp ecx, ETH_FRAME_LEN
|
||||||
|
@ -709,7 +715,7 @@ transmit:
|
||||||
mov al, CMD_PS0 + CMD_TXP + CMD_RD2 + CMD_STA
|
mov al, CMD_PS0 + CMD_TXP + CMD_RD2 + CMD_STA
|
||||||
out dx, al
|
out dx, al
|
||||||
|
|
||||||
DEBUGF 1,"Packet Sent!\n"
|
DEBUGF 1, "Packet Sent!\n"
|
||||||
|
|
||||||
inc [device.packets_tx]
|
inc [device.packets_tx]
|
||||||
mov eax, [esp + 8] ; Get packet size in eax
|
mov eax, [esp + 8] ; Get packet size in eax
|
||||||
|
@ -722,7 +728,7 @@ transmit:
|
||||||
ret 8
|
ret 8
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
DEBUGF 2,"Transmit error!\n"
|
DEBUGF 2, "Transmit error!\n"
|
||||||
|
|
||||||
or eax, -1
|
or eax, -1
|
||||||
stdcall KernelFree, [esp+4]
|
stdcall KernelFree, [esp+4]
|
||||||
|
@ -741,7 +747,7 @@ int_handler:
|
||||||
|
|
||||||
push ebx esi edi
|
push ebx esi edi
|
||||||
|
|
||||||
DEBUGF 1,"\n%s int\n", my_service
|
DEBUGF 1, "INT\n"
|
||||||
|
|
||||||
; find pointer of device wich made INT occur
|
; find pointer of device wich made INT occur
|
||||||
|
|
||||||
|
@ -773,7 +779,7 @@ int_handler:
|
||||||
|
|
||||||
.got_it:
|
.got_it:
|
||||||
|
|
||||||
DEBUGF 1,"Device=%x status=%x\n", ebx, eax:2
|
DEBUGF 1, "Device=%x status=%x\n", ebx, eax:2
|
||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
|
|
||||||
|
@ -860,7 +866,7 @@ int_handler:
|
||||||
|
|
||||||
; update stats
|
; update stats
|
||||||
|
|
||||||
DEBUGF 1,"Received %u bytes\n", ecx
|
DEBUGF 1, "Received %u bytes\n", ecx
|
||||||
|
|
||||||
add dword[device.bytes_rx], ecx
|
add dword[device.bytes_rx], ecx
|
||||||
adc dword[device.bytes_rx + 4], 0
|
adc dword[device.bytes_rx + 4], 0
|
||||||
|
@ -927,7 +933,7 @@ int_handler:
|
||||||
|
|
||||||
.no_rx:
|
.no_rx:
|
||||||
pop ebx
|
pop ebx
|
||||||
DEBUGF 1,"done\n"
|
DEBUGF 1, "done\n"
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
set_io P0_ISR
|
set_io P0_ISR
|
||||||
|
@ -951,7 +957,7 @@ int_handler:
|
||||||
align 4
|
align 4
|
||||||
write_mac: ; in: mac on stack (6 bytes)
|
write_mac: ; in: mac on stack (6 bytes)
|
||||||
|
|
||||||
DEBUGF 1,"Writing MAC\n"
|
DEBUGF 1, "Writing MAC\n"
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
mov al, CMD_PS1; + CMD_RD2 + CMD_STP
|
mov al, CMD_PS1; + CMD_RD2 + CMD_STP
|
||||||
|
@ -978,7 +984,7 @@ write_mac: ; in: mac on stack (6 bytes)
|
||||||
|
|
||||||
read_mac:
|
read_mac:
|
||||||
|
|
||||||
DEBUGF 1,"Reading MAC\n"
|
DEBUGF 1, "Reading MAC\n"
|
||||||
|
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
mov cx, 16
|
mov cx, 16
|
||||||
|
@ -998,7 +1004,7 @@ read_mac:
|
||||||
.8bit:
|
.8bit:
|
||||||
loop .loop
|
loop .loop
|
||||||
|
|
||||||
DEBUGF 1,"MAC=%x-%x-%x-%x-%x-%x\n",\
|
DEBUGF 1, "MAC=%x-%x-%x-%x-%x-%x\n",\
|
||||||
[device.mac]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
|
[device.mac]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -1016,7 +1022,7 @@ read_mac:
|
||||||
;***************************************************************************
|
;***************************************************************************
|
||||||
PIO_read:
|
PIO_read:
|
||||||
|
|
||||||
DEBUGF 1,"PIO Read from %x to %x, %u bytes ", si, edi, cx
|
DEBUGF 1, "PIO Read from %x to %x, %u bytes ", si, edi, cx
|
||||||
|
|
||||||
; start DMA
|
; start DMA
|
||||||
set_io 0
|
set_io 0
|
||||||
|
@ -1052,7 +1058,7 @@ PIO_read:
|
||||||
test [device.flags], FLAG_16BIT
|
test [device.flags], FLAG_16BIT
|
||||||
jz .8bits
|
jz .8bits
|
||||||
|
|
||||||
DEBUGF 1,"(16-bit mode)\n"
|
DEBUGF 1, "(16-bit mode)\n"
|
||||||
|
|
||||||
shr cx, 1 ; note that if the number was odd, carry flag will be set
|
shr cx, 1 ; note that if the number was odd, carry flag will be set
|
||||||
pushf
|
pushf
|
||||||
|
@ -1068,7 +1074,7 @@ PIO_read:
|
||||||
jmp .8bits_
|
jmp .8bits_
|
||||||
|
|
||||||
.8bits:
|
.8bits:
|
||||||
DEBUGF 1,"(8-bit mode)\n"
|
DEBUGF 1, "(8-bit mode)\n"
|
||||||
|
|
||||||
.8bits_:
|
.8bits_:
|
||||||
in al, dx
|
in al, dx
|
||||||
|
@ -1104,7 +1110,7 @@ PIO_read:
|
||||||
;***************************************************************************
|
;***************************************************************************
|
||||||
PIO_write:
|
PIO_write:
|
||||||
|
|
||||||
DEBUGF 1,"Eth PIO Write from %x to %x, %u bytes ", esi, di, cx
|
DEBUGF 1, "Eth PIO Write from %x to %x, %u bytes ", esi, di, cx
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
; set_io P0_COMMAND
|
; set_io P0_COMMAND
|
||||||
|
@ -1138,7 +1144,7 @@ PIO_write:
|
||||||
test [device.flags], FLAG_16BIT
|
test [device.flags], FLAG_16BIT
|
||||||
jz .8_bit
|
jz .8_bit
|
||||||
|
|
||||||
DEBUGF 1,"(16-bit mode)\n"
|
DEBUGF 1, "(16-bit mode)\n"
|
||||||
|
|
||||||
shr cx, 1 ; note that if the number was odd, carry flag will be set
|
shr cx, 1 ; note that if the number was odd, carry flag will be set
|
||||||
pushf ; save the flags for later
|
pushf ; save the flags for later
|
||||||
|
@ -1155,7 +1161,7 @@ PIO_write:
|
||||||
|
|
||||||
.8_bit:
|
.8_bit:
|
||||||
|
|
||||||
DEBUGF 1,"(8-bit mode)\n"
|
DEBUGF 1, "(8-bit mode)\n"
|
||||||
|
|
||||||
.8_bit_:
|
.8_bit_:
|
||||||
lodsb
|
lodsb
|
||||||
|
|
|
@ -27,7 +27,7 @@ format MS COFF
|
||||||
|
|
||||||
DEBUG = 1
|
DEBUG = 1
|
||||||
__DEBUG__ = 1
|
__DEBUG__ = 1
|
||||||
__DEBUG_LEVEL__ = 2
|
__DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only
|
||||||
|
|
||||||
include '../proc32.inc'
|
include '../proc32.inc'
|
||||||
include '../imports.inc'
|
include '../imports.inc'
|
||||||
|
@ -237,7 +237,7 @@ proc START stdcall, state:dword
|
||||||
|
|
||||||
.entry:
|
.entry:
|
||||||
|
|
||||||
DEBUGF 2, "Loading %s driver\n", my_service
|
DEBUGF 1, "Loading driver\n"
|
||||||
stdcall RegService, my_service, service_proc
|
stdcall RegService, my_service, service_proc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ proc service_proc stdcall, ioctl:dword
|
||||||
|
|
||||||
PCI_find_irq
|
PCI_find_irq
|
||||||
|
|
||||||
DEBUGF 2, "Hooking into device, dev:%x, bus:%x, irq:%x, I/O addr:%x\n",\
|
DEBUGF 1, "Hooking into device, dev:%x, bus:%x, irq:%x, I/O addr:%x\n",\
|
||||||
[device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4
|
[device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4
|
||||||
|
|
||||||
; Allocate the receive buffer
|
; Allocate the receive buffer
|
||||||
|
@ -371,11 +371,11 @@ proc service_proc stdcall, ioctl:dword
|
||||||
; If the device was already loaded, find the device number and return it in eax
|
; If the device was already loaded, find the device number and return it in eax
|
||||||
|
|
||||||
.find_devicenum:
|
.find_devicenum:
|
||||||
DEBUGF 2, "Trying to find device number of already registered device\n"
|
DEBUGF 1, "Trying to find device number of already registered device\n"
|
||||||
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
||||||
; into a device number in edi
|
; into a device number in edi
|
||||||
mov eax, edi ; Application wants it in eax instead
|
mov eax, edi ; Application wants it in eax instead
|
||||||
DEBUGF 2, "Kernel says: %u\n", eax
|
DEBUGF 1, "Kernel says: %u\n", eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; If an error occured, remove all allocated data and exit (returning -1 in eax)
|
; If an error occured, remove all allocated data and exit (returning -1 in eax)
|
||||||
|
@ -385,6 +385,7 @@ proc service_proc stdcall, ioctl:dword
|
||||||
; todo: reset device into virgin state
|
; todo: reset device into virgin state
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
|
DEBUGF 2, "Error, removing all data !\n"
|
||||||
stdcall KernelFree, [device.rx_buffer]
|
stdcall KernelFree, [device.rx_buffer]
|
||||||
stdcall KernelFree, ebx
|
stdcall KernelFree, ebx
|
||||||
|
|
||||||
|
@ -425,7 +426,7 @@ ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
probe:
|
probe:
|
||||||
DEBUGF 2, "Probing %s device\n", my_service
|
DEBUGF 1, "Probing\n"
|
||||||
|
|
||||||
PCI_make_bus_master
|
PCI_make_bus_master
|
||||||
|
|
||||||
|
@ -455,7 +456,7 @@ probe:
|
||||||
mov ecx, [crosslist+ecx*4]
|
mov ecx, [crosslist+ecx*4]
|
||||||
mov [device.name], ecx
|
mov [device.name], ecx
|
||||||
|
|
||||||
DEBUGF 2, "Chip version: %s\n", ecx
|
DEBUGF 1, "Chip version: %s\n", ecx
|
||||||
|
|
||||||
; wake up the chip
|
; wake up the chip
|
||||||
set_io 0
|
set_io 0
|
||||||
|
@ -498,7 +499,7 @@ probe:
|
||||||
set_io 0
|
set_io 0
|
||||||
set_io REG_9346CR
|
set_io REG_9346CR
|
||||||
out dx, al
|
out dx, al
|
||||||
DEBUGF 2, "done!\n"
|
DEBUGF 1, "probing done!\n"
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
|
@ -512,7 +513,7 @@ probe:
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
DEBUGF 2, "Reset\n"
|
DEBUGF 1, "Reset\n"
|
||||||
|
|
||||||
; attach int handler
|
; attach int handler
|
||||||
movzx eax, [device.irq_line]
|
movzx eax, [device.irq_line]
|
||||||
|
@ -520,7 +521,7 @@ reset:
|
||||||
stdcall AttachIntHandler, eax, int_handler, dword 0
|
stdcall AttachIntHandler, eax, int_handler, dword 0
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
DEBUGF 1, "\nCould not attach int handler!\n"
|
DEBUGF 2, "Could not attach int handler!\n"
|
||||||
; or eax, -1
|
; or eax, -1
|
||||||
; ret
|
; ret
|
||||||
@@:
|
@@:
|
||||||
|
@ -538,7 +539,7 @@ reset:
|
||||||
jz .reset_completed ; RST remains 1 during reset
|
jz .reset_completed ; RST remains 1 during reset
|
||||||
dec cx
|
dec cx
|
||||||
jns .wait_for_reset
|
jns .wait_for_reset
|
||||||
DEBUGF 1, "Reset timeout!\n"
|
DEBUGF 2, "Reset timeout!\n"
|
||||||
.reset_completed:
|
.reset_completed:
|
||||||
|
|
||||||
; unlock config and BMCR registers
|
; unlock config and BMCR registers
|
||||||
|
@ -641,7 +642,7 @@ reset:
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
align 4
|
align 4
|
||||||
transmit:
|
transmit:
|
||||||
DEBUGF 1, "\nTransmitting packet, buffer:%x, size:%u\n", [esp+4], [esp+8]
|
DEBUGF 1, "Transmitting packet, buffer:%x, size:%u\n", [esp+4], [esp+8]
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4]
|
||||||
DEBUGF 1, "To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
|
DEBUGF 1, "To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
|
||||||
[eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
|
[eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
|
||||||
|
@ -710,7 +711,7 @@ transmit:
|
||||||
jmp .send_packet
|
jmp .send_packet
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
DEBUGF 1, "failed!\n"
|
DEBUGF 2, "transmit failed!\n"
|
||||||
stdcall KernelFree, [esp+4]
|
stdcall KernelFree, [esp+4]
|
||||||
or eax, -1
|
or eax, -1
|
||||||
ret 8
|
ret 8
|
||||||
|
@ -730,7 +731,7 @@ int_handler:
|
||||||
|
|
||||||
push ebx esi edi
|
push ebx esi edi
|
||||||
|
|
||||||
DEBUGF 1, "\n%s int\n", my_service
|
DEBUGF 1, "INT\n"
|
||||||
|
|
||||||
; find pointer of device wich made IRQ occur
|
; find pointer of device wich made IRQ occur
|
||||||
mov ecx, [devices]
|
mov ecx, [devices]
|
||||||
|
@ -774,7 +775,7 @@ int_handler:
|
||||||
test al, BUFE ; test if RX buffer is empty
|
test al, BUFE ; test if RX buffer is empty
|
||||||
jnz .finish
|
jnz .finish
|
||||||
|
|
||||||
DEBUGF 1, "RX: "
|
DEBUGF 1, "RX:\n"
|
||||||
|
|
||||||
mov eax, [device.rx_buffer]
|
mov eax, [device.rx_buffer]
|
||||||
add eax, [device.rx_data_offset]
|
add eax, [device.rx_data_offset]
|
||||||
|
@ -831,7 +832,7 @@ int_handler:
|
||||||
|
|
||||||
cmp eax, RX_BUFFER_SIZE
|
cmp eax, RX_BUFFER_SIZE
|
||||||
jb .no_wrap
|
jb .no_wrap
|
||||||
DEBUGF 1, "Wrapping"
|
DEBUGF 1, "Wrapping\n"
|
||||||
sub eax, RX_BUFFER_SIZE
|
sub eax, RX_BUFFER_SIZE
|
||||||
.no_wrap:
|
.no_wrap:
|
||||||
mov [device.rx_data_offset], eax
|
mov [device.rx_data_offset], eax
|
||||||
|
@ -847,12 +848,12 @@ int_handler:
|
||||||
.reset_rx:
|
.reset_rx:
|
||||||
test byte [eax], (1 shl BIT_CRC)
|
test byte [eax], (1 shl BIT_CRC)
|
||||||
jz .no_crc_error
|
jz .no_crc_error
|
||||||
DEBUGF 2, "\nCRC error!\n"
|
DEBUGF 2, "RX: CRC error!\n"
|
||||||
|
|
||||||
.no_crc_error:
|
.no_crc_error:
|
||||||
test byte [eax], (1 shl BIT_FAE)
|
test byte [eax], (1 shl BIT_FAE)
|
||||||
jz .no_fae_error
|
jz .no_fae_error
|
||||||
DEBUGF 1, "\nFrame alignment error!\n"
|
DEBUGF 2, "RX: Frame alignment error!\n"
|
||||||
|
|
||||||
.no_fae_error:
|
.no_fae_error:
|
||||||
DEBUGF 1, "Reset RX\n"
|
DEBUGF 1, "Reset RX\n"
|
||||||
|
@ -930,7 +931,7 @@ int_handler:
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
push ax
|
push ax
|
||||||
DEBUGF 2, "RX-buffer overflow!\n"
|
DEBUGF 2, "RX:buffer overflow!\n"
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
set_io REG_ISR
|
set_io REG_ISR
|
||||||
|
@ -944,7 +945,7 @@ int_handler:
|
||||||
test ax, ISR_PUN
|
test ax, ISR_PUN
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
DEBUGF 2, "Packet underrun!\n"
|
DEBUGF 2, "RX:Packet underrun!\n"
|
||||||
|
|
||||||
;----------------------------------------------------
|
;----------------------------------------------------
|
||||||
; Receive FIFO overflow ?
|
; Receive FIFO overflow ?
|
||||||
|
@ -953,7 +954,7 @@ int_handler:
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
push ax
|
push ax
|
||||||
DEBUGF 2, "RX fifo overflow!\n"
|
DEBUGF 2, "RX:fifo overflow!\n"
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
set_io REG_ISR
|
set_io REG_ISR
|
||||||
|
@ -970,7 +971,6 @@ int_handler:
|
||||||
call cable
|
call cable
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
DEBUGF 1, "\n"
|
|
||||||
pop edi esi ebx
|
pop edi esi ebx
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
inc eax
|
inc eax
|
||||||
|
@ -1029,7 +1029,7 @@ cable:
|
||||||
align 4
|
align 4
|
||||||
write_mac: ; in: mac pushed onto stack (as 3 words)
|
write_mac: ; in: mac pushed onto stack (as 3 words)
|
||||||
|
|
||||||
DEBUGF 2, "Writing MAC: "
|
DEBUGF 1, "Writing MAC\n"
|
||||||
|
|
||||||
; disable all in command registers
|
; disable all in command registers
|
||||||
set_io 0
|
set_io 0
|
||||||
|
@ -1065,7 +1065,7 @@ write_mac: ; in: mac pushed onto stack (as 3 words)
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
out dx, al
|
out dx, al
|
||||||
|
|
||||||
DEBUGF 2, "ok!\n"
|
DEBUGF 1, "MAC write ok!\n"
|
||||||
|
|
||||||
; Notice this procedure does not ret, but continues to read_mac instead.
|
; Notice this procedure does not ret, but continues to read_mac instead.
|
||||||
|
|
||||||
|
@ -1077,7 +1077,7 @@ write_mac: ; in: mac pushed onto stack (as 3 words)
|
||||||
;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
read_mac:
|
read_mac:
|
||||||
DEBUGF 2, "Reading MAC: "
|
DEBUGF 2, "Reading MAC:\n"
|
||||||
|
|
||||||
set_io 0
|
set_io 0
|
||||||
lea edi, [device.mac]
|
lea edi, [device.mac]
|
||||||
|
|
Loading…
Reference in New Issue