1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; i8254x driver for KolibriOS ;; |
749,10 → 749,11 |
;; Out: eax = 0 on success ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 16 |
|
proc transmit stdcall bufferptr |
|
spin_lock_irqsave |
pushf |
cli |
|
mov esi, [bufferptr] |
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length] |
800,7 → 801,7 |
|
call clean_tx |
|
spin_unlock_irqrestore |
popf |
xor eax, eax |
ret |
|
809,7 → 810,7 |
|
DEBUGF 2,"Send failed\n" |
invoke NetFree, [bufferptr] |
spin_unlock_irqrestore |
popf |
or eax, -1 |
ret |
|
821,25 → 822,39 |
;; Interrupt handler ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;; |
align 16 |
|
align 4 |
int_handler: |
|
push ebx esi edi |
|
mov ebx, [esp+4*4] |
DEBUGF 1,"INT for 0x%x\n", ebx |
DEBUGF 1,"INT\n" |
;------------------------------------------- |
; Find pointer of device wich made IRQ occur |
|
; TODO? if we are paranoid, we can check that the value from ebx is present in the current device_list |
|
mov ecx, [devices] |
test ecx, ecx |
jz .nothing |
mov esi, device_list |
.nextdevice: |
mov ebx, [esi] |
mov edi, [ebx + device.mmio_addr] |
mov eax, [edi + REG_ICR] |
cmp eax, 0xffffffff ; if so, hardware is no longer present |
je .nothing ; |
test eax, eax |
jz .nothing |
jnz .got_it |
.continue: |
add esi, 4 |
dec ecx |
jnz .nextdevice |
.nothing: |
pop edi esi ebx |
xor eax, eax |
|
DEBUGF 1,"Status: %x\n", eax |
ret |
|
.got_it: |
DEBUGF 1,"Device: %x Status: %x\n", ebx, eax |
|
;--------- |
; RX done? |
|
928,20 → 943,13 |
; call clean_tx |
|
.no_tx: |
|
pop edi esi ebx |
xor eax, eax |
inc eax |
ret |
|
.nothing: |
pop edi esi ebx |
xor eax, eax |
|
ret |
|
|
|
clean_tx: |
|
.txdesc_loop: |