Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2925 → Rev 2924

/kernel/branches/net/drivers/i8254x.asm
260,9 → 260,6
.pci_dev dd ?
.irq_line db ?
 
.cur_tx dd ?
.last_tx dd ?
 
rb 0x100 - (($ - device) and 0xff)
.rx_desc rd 256/8
 
412,8 → 409,6
mov [device_list+4*eax], ebx ; (IRQ handler uses this list to find device)
inc [devices] ;
 
call start_i8254x
 
mov [device.type], NET_TYPE_ETH
call NetRegDev
 
498,7 → 493,7
@@:
 
 
reset_dontstart:
reset:
DEBUGF 1,"Reset\n"
 
mov esi, [device.mmio_addr]
554,11 → 549,6
mov dword [esi + REG_TIPG], 0x0060200A ; IPGT 10, IPGR1 8, IPGR2 6
 
xor eax, eax
ret
 
start_i8254x:
 
xor eax, eax
mov [esi + REG_RDTR], eax ; Clear the Receive Delay Timer Register
mov [esi + REG_RADV], eax ; Clear the Receive Interrupt Absolute Delay Timer
mov [esi + REG_RSRPD], eax ; Clear the Receive Small Packet Detect Interrupt
571,15 → 561,8
xor eax, eax
ret
 
align 4
reset:
call reset_dontstart
call start_i8254x
 
ret
 
 
 
align 4
read_mac:
 
643,7 → 626,6
cmp dword [esp + 8], 60
jl .fail
 
 
; Program the descriptor (use legacy mode)
lea edi, [device.tx_desc] ; Transmit Descriptor Base Address
mov dword [edi + 16], eax ; Store the data location (for driver)
712,16 → 694,10
push eax
push .retaddr
 
; Get last descriptor addr
lea esi, [device.rx_desc]
 
cmp byte [esi + 12], 0 ; Check status field
je .retaddr
 
movzx ecx, word [esi + 8] ; Get the packet length
movzx ecx, word [device.rx_desc + 8] ; Get the packet length
DEBUGF 2,"got %u bytes\n", ecx
push ecx
push dword [esi + 16] ; Get packet pointer
push [device.rx_desc + 16] ; Get packet pointer
 
; Update stats
add dword [device.bytes_rx], ecx
730,9 → 706,9
 
; allocate new descriptor
stdcall KernelAlloc, 48*1024
mov dword [esi + 16], eax
mov dword [device.rx_desc + 16], eax
GetRealAddr
mov dword [esi], eax
mov dword [device.rx_desc], eax
 
; reset descriptor status
mov esi, [device.mmio_addr]
762,11 → 738,8
jz .no_tx
 
DEBUGF 2,"Transmit done\n"
; TODO: clear up used buffers
 
lea edi, [device.tx_desc] ; Transmit Descriptor Base Address
push dword [edi + 16] ; Store the data location (for driver)
call KernelFree
 
.no_tx:
.fail:
ret