Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5522 → Rev 5521

/drivers/ethernet/RTL8029.asm
665,18 → 665,17
;***************************************************************************
; Function
; transmit
; buffer in [esp+4], pointer to device struct in ebx
; buffer in [esp+4], size in [esp+8], pointer to device struct in ebx
;***************************************************************************
 
proc transmit stdcall buffer_ptr
proc transmit stdcall buffer_ptr, buffer_size
 
pushf
cli
 
mov esi, [buffer_ptr]
mov ecx, [esi + NET_BUFF.length]
mov ecx, [buffer_size]
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", esi, ecx
lea eax, [esi + NET_BUFF.data]
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
 
687,10 → 686,9
 
movzx edi, [ebx + device.tx_start]
shl edi, 8
add esi, [esi + NET_BUFF.offset]
push ecx
push cx
call PIO_write
pop ecx
pop cx
 
set_io [ebx + device.io_addr], 0
; set_io [ebx + device.io_addr], P0_COMMAND
716,10 → 714,11
DEBUGF 1, "Packet Sent!\n"
 
inc [ebx + device.packets_tx]
add dword[ebx + device.bytes_tx], ecx
mov eax, [buffer_size]
add dword[ebx + device.bytes_tx], eax
adc dword[ebx + device.bytes_tx + 4], 0
 
invoke NetFree, [buffer_ptr]
invoke KernelFree, [buffer_ptr]
popf
xor eax, eax
ret
726,7 → 725,7
 
.err:
DEBUGF 2, "Transmit error!\n"
invoke NetFree, [buffer_ptr]
invoke KernelFree, [buffer_ptr]
popf
or eax, -1
ret
786,15 → 785,14
jz .no_rx ; FIXME: Only PIO mode supported for now
 
; allocate a buffer
invoke NetAlloc, ETH_FRAME_LEN+NET_BUFF.data
invoke KernelAlloc, ETH_FRAME_LEN
test eax, eax
jz .rx_fail_2
 
; Push return address and packet ptr to stack
pushd .no_rx
pushd 0 ; Reserve some space for the packet size
push eax
mov [eax + NET_BUFF.device], ebx
mov [eax + NET_BUFF.offset], NET_BUFF.data
 
; read offset for current packet from device
set_io [ebx + device.io_addr], 0
828,8 → 826,8
movzx esi, ch ; we are using 256 byte pages
shl esi, 8 ; esi now holds the offset for current packet
 
; Write packet header to frame header size field
push ecx
; Get packet header in ecx
push ecx ; reserve 4 bytes on stack to put packet header in
mov edi, esp
mov cx, 4
call PIO_read
842,8 → 840,7
; calculate packet length in ecx
shr ecx, 16
sub ecx, 4 ; CRC doesnt count as data byte
mov edi, [esp+4]
mov [edi + NET_BUFF.length], ecx
mov [esp + 8], ecx
 
; check if packet size is ok
cmp ecx, ETH_ZLEN
859,7 → 856,7
 
; update read and write pointers
add esi, 4
add edi, NET_BUFF.data
mov edi, [esp + 4]
 
; now check if we can read all data at once (if we cross the end boundary, we need to wrap back to the beginning)
xor eax, eax
897,7 → 894,7
out dx, al
 
; now send the data to the kernel
jmp [EthInput]
jmp [Eth_input]
 
.rx_fail_3:
add esp, 4