Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1253 → Rev 1254

/kernel/branches/net/drivers/RTL8029.asm
758,7 → 758,7
;***************************************************************************
; Function
; transmit
; buffer in [esp], size in [esp+4], pointer to device struct in ebx
; buffer in [esp+4], size in [esp+8], pointer to device struct in ebx
;***************************************************************************
 
align 4
765,14 → 765,14
transmit:
mov ebp, ebx
 
mov esi, [esp]
mov ecx, [esp + 4]
mov esi, [esp + 4]
mov ecx, [esp + 8]
DEBUGF 2,"Transmitting packet, buffer:%x, size:%u\n",esi, ecx
DEBUGF 2,"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
 
cmp dword [esp+4], ETH_FRAME_LEN
cmp dword [esp + 8], ETH_FRAME_LEN
jg .finish ; packet is too long
cmp dword [esp+4], 60
cmp dword [esp + 8], 60
jl .finish ; packet is too short
 
xor bl, bl
804,15 → 804,12
DEBUGF 2," - Packet Sent!\n"
 
inc [ebp+device.packets_tx] ;
mov eax, [esp+4] ; Get packet size in eax
mov eax, [esp + 8] ; Get packet size in eax
 
add dword [ebp + device.bytes_tx], eax
adc dword [ebp + device.bytes_tx + 4], 0
.finish:
mov ebx, ebp
 
call KernelFree
add esp, 4 ; pop (balance stack)
xor eax, eax
 
ret
/kernel/branches/net/drivers/RTL8139.asm
7,7 → 7,8
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
;; ;;
;; v0.1 - march 2009 ;;
;; 0.1 - x march 2009 ;;
;; 0.2 - 8 november 2009 ;;
;; ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
14,8 → 15,6
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision$
 
format MS COFF
 
API_VERSION equ 0x01000100
766,8 → 765,8
;; ;;
;; Transmit ;;
;; ;;
;; In: buffer pointer in [esp] ;;
;; size of buffer in [esp+4] ;;
;; In: buffer pointer in [esp+4] ;;
;; size of buffer in [esp+8] ;;
;; pointer to device structure in ebx ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
774,16 → 773,16
 
align 4
transmit:
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",[esp],[esp+4]
mov eax, [esp]
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",[esp+4],[esp+8]
mov eax, [esp+4]
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+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
[eax+13]:2,[eax+12]:2
 
cmp dword [esp+4], MAX_ETH_FRAME_SIZE
cmp dword [esp+8], MAX_ETH_FRAME_SIZE
jg .finish ; packet is too long
cmp dword [esp+4], 60
cmp dword [esp+8], 60
jl .finish ; packet is too short
 
; check descriptor
822,16 → 821,16
add edi, eax ; Store it in edi
pop edx
 
mov esi, [esp] ; Copy data to that address
mov ecx, [esp+4] ;
mov esi, [esp+4] ; Copy data to that address
mov ecx, [esp+8] ;
shr ecx, 2 ;
rep movsd ;
mov ecx, [esp+4] ;
mov ecx, [esp+8] ;
and ecx, 3 ;
rep movsb ;
 
inc [ebx+device.packets_tx] ;
mov eax, [esp+4] ; Get packet size in eax
mov eax, [esp+8] ; Get packet size in eax
 
add dword [ebx + device.bytes_tx], eax
adc dword [ebx + device.bytes_tx + 4], 0
846,9 → 845,6
DEBUGF 2," - Packet Sent! "
.finish:
DEBUGF 2," - Done!\n"
call KernelFree
add esp, 4 ; pop (balance stack)
 
ret
 
 
/kernel/branches/net/drivers/pcnet32.asm
1138,8 → 1138,8
;; ;;
;; Transmit ;;
;; ;;
;; In: buffer pointer in [esp] ;;
;; size of buffer in [esp+4] ;;
;; In: buffer pointer in [esp+4] ;;
;; size of buffer in [esp+8] ;;
;; pointer to device structure in ebx ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1147,15 → 1147,15
align 4
transmit:
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",[esp],[esp+4]
mov eax, [esp]
mov eax, [esp+4]
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+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
[eax+13]:2,[eax+12]:2
 
cmp dword [esp+4], 1514
cmp dword [esp+8], 1514
jg .finish ; packet is too long
cmp dword [esp+4], 60
cmp dword [esp+8], 60
jl .finish ; packet is too short
 
; check descriptor
1167,8 → 1167,8
test byte [eax + buf_head.status + 1], 80h
jnz .nospace
; descriptor is free, copy data
mov esi, [esp]
mov ecx, [esp+4]
mov esi, [esp+4]
mov ecx, [esp+8]
mov edx, ecx
shr ecx, 2
and edx, 3
1176,7 → 1176,7
mov ecx, edx
rep movsb
; set length
mov ecx, [esp+4]
mov ecx, [esp+8]
neg ecx
mov [eax + buf_head.length], cx
; put to transfer queue
1195,15 → 1195,11
 
.finish:
DEBUGF 2," - Done!\n"
;;; call KernelFree
add esp, 4+4 ; pop (balance stack)
 
ret
 
.nospace:
DEBUGF 1, 'ERROR: no free transmit descriptors\n'
; todo: maybe somehow notify the kernel about the error?
add esp, 4+4
ret
 
 
/kernel/branches/net/drivers/sis900.asm
1249,8 → 1249,8
; transmit
; Description
; Transmits a packet of data via the ethernet card
; buffer pointer in [esp]
; size of buffer in [esp+4]
; buffer pointer in [esp+4]
; size of buffer in [esp+8]
; pointer to device structure in ebx
;
; only one transmit descriptor is used
1263,9 → 1263,9
str1 db 'Transmitting packet:',13,10,0
str2 db ' ',0
transmit:
cmp dword [esp+4], MAX_ETH_FRAME_SIZE
cmp dword [esp+8], MAX_ETH_FRAME_SIZE
jg transmit_finish
cmp dword [esp+4], 60
cmp dword [esp+8], 60
jl transmit_finish
push ebp
mov ebp, [ebx+device.io_addr] ; Base Address
1281,9 → 1281,9
add eax, device.txd
out dx, eax
;******* copy packet to descriptor*******
mov esi, [esp+4]
mov esi, [esp+8]
lea edi, [ebx+0x1000]
mov ecx, [esp+8]
mov ecx, [esp+12]
mov edx, ecx
shr ecx, 2
and edx, 3
1291,7 → 1291,7
mov ecx, edx
rep movsb
;**************set length tag**************
mov ecx, [esp+8] ;restore packet size
mov ecx, [esp+12] ;restore packet size
and ecx, SIS900_DSIZE ;
inc [ebx+device.packets_tx]
add dword [ebx+device.bytes_tx], ecx
1331,8 → 1331,6
SIS900_transmit_OK:
pop ebp
transmit_finish:
call KernelFree
add esp, 4
ret
 
;***************************************************************************