Completion of the new SIS900 driver.

-cleanup of used packets after they are sent
-transmit function now checks first if the descriptor is free

git-svn-id: svn://kolibrios.org@2912 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-08-08 10:03:47 +00:00
parent 8ba3e5e11b
commit 940c0c5fa6

View File

@ -574,6 +574,7 @@ reset:
out dx, eax
mov [device.cur_tx], 0 ; Set current tx descriptor to 0
mov [device.last_tx], 0
DEBUGF 1, "Initialising RX Descriptors\n"
@ -991,8 +992,8 @@ transmit:
shl ecx, 4 ; *16
lea ecx, [device.txd + ecx]
;; TODO: check if desc is empty (for example: check for eax, 0x6200000 at [ecx+4]
;;; or: count number of available descriptors
test dword [ecx + 4], 0x80000000 ; card owns descriptor ?
jnz .error
mov eax, [esp + 4]
mov dword [ecx + 12], eax
@ -1121,13 +1122,6 @@ int_handler:
inc [device.cur_rx] ; get next descriptor
and [device.cur_rx], NUM_RX_DESC-1 ; only 4 descriptors 0-3
; Enable Receiver CHECKME
; set_io 0
; set_io cr ; Command Register offset
; in eax, dx ; Get current Command Register
; or eax, RxENA ; Enable Receiver
; out dx, eax
pop ax
.no_rx:
@ -1136,8 +1130,24 @@ int_handler:
DEBUGF 1, "TX ok!\n"
;;; TODO: free all unused buffers
;; stdcall KernelFree, eax
.tx_loop:
movzx ecx, [device.last_tx]
shl ecx, 4 ; *16
lea ecx, [device.txd + ecx]
test dword [ecx + 4], 0x80000000 ; card owns descr
jnz .no_tx
cmp dword [ecx + 12], 0
je .no_tx
DEBUGF 1, "Freeing packet = %x\n", [ecx + 12]:8
push dword [ecx + 12]
mov dword [ecx + 12], 0
call KernelFree
inc [device.last_tx]
and [device.last_tx], NUM_TX_DESC-1
jmp .tx_loop
.no_tx: