Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5184 → Rev 5182

/drivers/ethernet/dec21x4x.asm
1227,7 → 1227,7
push eax esi ecx
DEBUGF 1,"TX ok!\n"
.loop_tx:
; get last descriptor
; go to last descriptor
mov eax, [ebx + device.last_tx]
mov edx, sizeof.desc
mul edx
1243,7 → 1243,7
DEBUGF 1,"Free buffer 0x%x\n", [eax + TX_RING_SIZE*sizeof.desc]
invoke KernelFree, [eax + TX_RING_SIZE*sizeof.desc]
 
; advance to next descriptor
; next descriptor
inc [ebx + device.last_tx]
and [ebx + device.last_tx], TX_RING_SIZE-1
 
1254,7 → 1254,6
 
;----------------------------------
; RX irq
 
test eax, CSR5_RI
jz .not_rx
push eax esi ecx
1271,7 → 1270,7
mul edx
lea edi, [ebx + device.rx_ring + eax]
 
; Check current RX descriptor status
; now check status
mov eax, [edi + desc.status]
 
test eax, DES0_OWN
1283,18 → 1282,24
test eax, RDES0_ES
jnz .end_rx
 
; Calculate length
mov esi, [edi + RX_RING_SIZE*sizeof.desc]
mov ecx, [edi + desc.status]
shr ecx, RDES0_FL_SH
and ecx, RDES0_FL_MASK
sub ecx, 4 ; throw away the CRC
DEBUGF 1,"got %u bytes\n", ecx
sub ecx, 4 ; crc, we dont need it
 
; Push arguments for Eth_input (and some more...)
DEBUGF 1,"size=%u, addr:0x%x\n", ecx, esi
 
push esi edi ecx
invoke KernelAlloc, ecx ; Allocate a buffer to put packet into
pop ecx edi esi
test eax, eax
jz .fail
 
push ebx
push .rx_loop ; return addr
push ecx ; packet size
push dword[edi + RX_RING_SIZE*sizeof.desc] ; packet ptr
push dword .rx_loop
push ecx eax
xchg edi, eax
 
; update statistics
inc [ebx + device.packets_rx]
1301,21 → 1306,27
add dword[ebx + device.bytes_rx], ecx
adc dword[ebx + device.bytes_rx + 4], 0
 
; Allocate new descriptor
push edi ebx
invoke KernelAlloc, 1536 ; Allocate a buffer to put packet into
pop ebx edi
mov [edi + RX_RING_SIZE*sizeof.desc], eax
invoke GetPhysAddr
mov [edi + desc.buffer1], eax
mov [edi + desc.status], DES0_OWN ; mark descriptor as being free
; copy packet data
shr cx, 1
jnc .nb
movsb
.nb:
shr cx, 1
jnc .nw
movsw
.nw:
rep movsd
 
; Move to next rx desc
mov [eax + desc.status], DES0_OWN ; free descriptor
inc [ebx + device.cur_rx] ; next descriptor
and [ebx + device.cur_rx], RX_RING_SIZE-1
 
jmp [Eth_input]
 
.end_rx:
.fail:
pop ecx esi eax
.not_rx:
 
pop edi esi ebx